On Wed, May 13, 2015 at 5:54 AM, Ian Kelly <ian.g.ke...@gmail.com> wrote: > Also, I like to put command-line parsing inside the main function and > make that its *only* responsibility. The main function then calls the > real entry point of my script, which will be something more > specifically named. This also has the advantage that if some other > module needs to invoke my script, all it has to do is call the entry > point function which will be named something more suitable than > "main".
That often makes sense, but sometimes doesn't. When it doesn't, you can usually tell because your main function looks something like this: def main(): do_real_work(*sys.argv) if __name__=="__main__": main() A one-line function that's called from one place? In-line it. if __name__ == "__main__": do_real_work(*sys.argv) ChrisA -- https://mail.python.org/mailman/listinfo/python-list