if __name__ == 'main': & passing an arg to a class object
Bart Willems
b.r.willems at gmail.com
Sun Apr 29 07:32:44 EDT 2007
gtb wrote:
> appear at the end of many examples I see. Is this to cause a .class
> file to be generated?
This might be obvious, but no one else mentioned it: the Python
interpreter cannot execute code that it hasn't compiled yet, which is
why the "if __name__ ..." code is always at the end of the module - to
guarantee that the entire file is scanned first.
More information about the Python-list
mailing list