[Python-ideas] Just __main__

Yuval Greenfield ubershmekel at gmail.com
Mon Jun 18 18:49:41 CEST 2012


On Mon, Jun 18, 2012 at 7:17 PM, Ethan Furman <ethan at stoneleaf.us> wrote:

> anatoly techtonik wrote:
>
>> How about global __main__ as a boolean?
>>
>> __name__ == '__main__' as a mark of entrypoint module is coherent and
>> logical, but awkward to type and requires explicit explaination for
>> newcomers even with prior background in other langauges.
>>
>
> So instead of:
>
>  if __name__ == '__main__':
>    ...
>
> you would have:
>
>  if __main__:
>    ...
>
> ?
>
> ~Ethan~
>
>
>
+1

Makes sense....

if __main__:
    sys.exit(main())

http://www.artima.com/weblogs/viewpost.jsp?thread=4829
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120618/92b88abe/attachment.html>


More information about the Python-ideas mailing list