[Python-ideas] Replacing the if __name__ == "__main__" idiom (was Re: making a module callable)

Antoine Pitrou solipsis at pitrou.net
Mon Nov 25 22:44:09 CET 2013


On Mon, 25 Nov 2013 13:22:53 -0800
Guido van Rossum <guido at python.org> wrote:
> 
> (I don't get the point against my is_main() proposal that it also uses
> magic. It's a builtin. *Of course* it is allowed to use magic.)

Just because it is allowed to use magic doesn't mean it's a good idea,
though. I can imagine people struggling to understand how it works
(and how they can replicate it), while the current idiom is very easy to
understand.

I still don't think the current idiom is problematic, so I'm -0.8 on
the whole thing :-)

Regards

Antoine.




More information about the Python-ideas mailing list