[Python-ideas] Replacing the if __name__ == "__main__" idiom (was Re: making a module callable)
Nick Coghlan
ncoghlan at gmail.com
Sun Nov 24 23:37:21 CET 2013
On 25 Nov 2013 08:28, "Greg Ewing" <greg.ewing at canterbury.ac.nz> wrote:
>
> Guido van Rossum wrote:
>>
>> Haven't followed all of this, but perhaps the simplest thing would be to
define a new builtin function that returns True in the namespace of the
main module and false everywhere else.
>
>
> Can someone remind me why there's so much resistance to
> simply blessing a __main__() function? It would be
> straightforward and intuitive and in line with what
> just about every other language does.
See my other email. Implementing it is not straightforward at all, and it's
only intuitive to people that have been trained to think that way by C,
Java, et al.
Cheers,
Nick.
>
> --
> Greg
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20131125/83d6b575/attachment.html>
More information about the Python-ideas
mailing list