The rules of reference
Mark Jackson
mjackson at alumni.caltech.edu
Thu Oct 31 14:33:19 EST 2002
gerson.kurz at t-online.de (Gerson Kurz) writes:
> Frankly, I'm stunned.
Shouldn't be. "python a.py" executes the code in file a.py in the
__main__ namespace. "import a (in b.py)" executes the code in file
a.py in module a's namespace. Try incanting "python -i a.py" to stay
at the interactive prompt and examining the values of num and
sys.modules['a'].num.
--
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
How can anyone be expected to govern a country with two
hundred and forty-six cheeses? - Charles de Gaulle
More information about the Python-list
mailing list