Usage of main()

r rt8396 at gmail.com
Sat Sep 5 18:22:57 EDT 2009


On Sep 4, 5:56 am, "Jan Kaliszewski" <z... at chopin.edu.pl> wrote:
> 04-09-2009 o 08:37:43 r <rt8... at gmail.com> wrote:
>
> > Why use a nested function when you already *in* main?
>
> I understand you name global scope as 'main'. But (independently
> of using the __main__ idiom and so on) it is still good idea not to
> place to much code in the global scope but to place your app-logic
> code in functions -- because, as we noted:
>
> * in practice it is considerably faster,
>
> * it helps you with using functions & class browsers.


Ah yes, thanks Jan!.
And the others mentioning of "side effects" from imports makes a lot
of sense too.




More information about the Python-list mailing list