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

Guido van Rossum guido at python.org
Mon Nov 25 23:31:08 CET 2013


On Mon, Nov 25, 2013 at 2:28 PM, Paul Moore <p.f.moore at gmail.com> wrote:

> PS This is assuming that nobody is suggesting breaking "if __name__ ==
> '__main__'". If they are, then that's a whole different debate.
>

My proposal is to define the builtin function as comparing __name__ to
'__main__', so the old idiom will still work. It will just eventually start
looking out of date.

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131125/3a0143b7/attachment.html>


More information about the Python-ideas mailing list