how to talk to __main__?
Michal Wallace
sabren at manifestation.com
Mon Feb 14 12:02:30 EST 2000
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?
I realize this is sort of bad practice to start out with... But,
for example... with my callback I wanted to do:
##########
allDone = 0
def callback():
allDone = 1 # allDone is local, so this won't work
#__main__.allDone = 1 # gives an error
# assign callback() to external event here...
while not allDone:
pass
print "All done!"
###########
-Michal
http://www.sabnren.com/
More information about the Python-list
mailing list