global variables or inheritence
Jeff Massung
jmassung at magpiesystems.com
Wed Apr 26 16:20:28 EDT 2000
>testprog1.py:
>import os, sys, string, testprog2
>def main():
> print 'hello'
> myvar = 2
> testprog2.second()
>if __name__ == '__main__':
> main()
NOTE: myvar is local to main() (not to the file)
>
>testprog2.py:
>import os, sys, string, testprog1
>def second():
> print testprog1.myvar
>if __name__ == '__main__':
> print 'nope'
>
Also, just as coding practice - you're cirular use of the files is VERY
bad... it can cause many problems (and is illegal in many languages - I
can't believe Python would allow it). What is your program that you need to
do this with? Just curious.
Jeff
More information about the Python-list
mailing list