Jack Jansen wrote: > As always, reading the source provides the answer. > > If you look in PyEdit.py, method Editor.execstring(), you'll see that > the only thing "run as __main__" does is set the module name to > "__main__". It does *not* change the globals dictionary to __main__. > > I'm not sure about the reasoning behind this, I think Just wanted to > make sure that if you had two edit windows open both with "run as > __main__" selected they didn't influence each other. On the other hand > I can imageine that if you do that, open two windows in __main__ mode, > the behaviour you want is exactly that.
It largely as Bob wrote: you can't do this sanely if the script runs in the same process as the IDE. And what you said: I don't want __main__ scripts to share a namespace. The "Run as __main__" feature is intended to support the if __name__ == "__main__" idiom, nothing else. Importing __main__ is a very silly thing to do anyway, if you ask me. Just _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor