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

marduk at letterboxes.org marduk at letterboxes.org
Wed Dec 11 07:57:32 EST 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
function.



More information about the Python-list mailing list