Usage of main()

Jan Kaliszewski zuo at
Fri Sep 4 12:43:05 CEST 2009

> So yes, depending on the nature of your code, its quite conceivable to
> find distinct performance differences between code using the __main__
> idiom and code without.

But -- it should be emphasized -- it's faster thanks to running code
(an doing name lookups) within a function, and *not* thanks to using
the __main__ idiom (i.e. 'if __name__ == "__main__":' condition).


Jan Kaliszewski (zuo) <zuo at>

More information about the Python-list mailing list