about main()

Marko Rauhamaa marko at pacujo.net
Thu Jul 5 07:20:04 EDT 2018


Rhodri James <rhodri at kynesim.co.uk>:
> I'm not a big fan of "main()" functions myself; creating a function
> which will be called exactly once seems rather wasteful.

A function is the encapsulation of a distinct ... well ... function.
Functions that are called just once are desirable.

So I'm saying the opposite:

 * Have no code outside functions.

 * Make the functions as small as (meaningfully) possible. Most should
   be smaller than 20 lines.

 * Create as many functions as you can.


Marko


More information about the Python-list mailing list