Is there any advantage to using a main() in python scripts?

marduk at marduk at
Wed Dec 11 13:57:32 CET 2013

I would agree with the previous post but also add that I've stopped
calling the main function "main()" and usually give it a more
descriptive name, such as "bake_cookies()" or whatever.  I think that
that makes it clearer what it's doing when used as a library and the 'if
__name__ == '__main__'" already implies that it is the "main" script

More information about the Python-list mailing list