[Python-ideas] Just __main__

Alexandre Zani alexandre.zani at gmail.com
Tue Jun 19 17:02:37 CEST 2012


-1 on a __main__ function. Seems like unnecessarily confusing magic.

-0 on a __main__ boolean. It just doesn't seem to add much value on
top of __name__ == '__main__'.

On Tue, Jun 19, 2012 at 4:27 AM, Yuval Greenfield <ubershmekel at gmail.com> wrote:
> On Tue, Jun 19, 2012 at 12:41 PM, Simon Sapin <simon.sapin at kozea.fr> wrote:
>>
>> Le 19/06/2012 09:52, anatoly techtonik a écrit :
>>
>>> Here is one more problem - when module is executed as a script, it
>>> loses its __name__, which becomes equal to '__main__'.
>>
>>
>> PEP 395 "Qualified Names for Modules" tries to address this.
>>
>> http://www.python.org/dev/peps/pep-0395/
>>
>
> I agree that python does not need any magic __main__ function. The __main__
> boolean is streets ahead in readability though.
>
> Yuval
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



More information about the Python-ideas mailing list