[Tutor] Why use main() ?
David Rock
david at graniteweb.com
Wed Jul 5 18:38:35 EDT 2017
* Alan Gauld via Tutor <tutor at python.org> [2017-07-05 20:36]:
> On 05/07/17 16:37, David Rock wrote:
>
> > This is a question about the benefits of using a main() function vs not.
>
>
> Others have answered for the pros, but I confess that I don't
> always use a main(), but only if all I'm doing is, say,
> instantiating a class and running a method. For anything
> more complex I'd write a main() (or test() or demo() ) to
> go inside the
> if name==main
> clause.
Thank you everyone for the input.
--
David Rock
david at graniteweb.com
More information about the Tutor
mailing list