how to talk to __main__?

Moshe Zadka moshez at math.huji.ac.il
Mon Feb 14 18:41:42 CET 2000


On Mon, 14 Feb 2000, Michal Wallace wrote:

> Hey all,
> 
> I understand why __name__ evaluates to "__main__",
> but how come you can't say __main__.x = 1 to reassign
> some global variable x?

a. you forgot "import __main__"
b. don't do it. Really. You destroy good code by tying it into a specific
application.

--
Moshe Zadka <mzadka at geocities.com>. 
INTERNET: Learn what you know.
Share what you don't.





More information about the Python-list mailing list