[Python-ideas] Just __main__
storchaka at gmail.com
Mon Jun 18 19:12:39 CEST 2012
On 18.06.12 19:17, Ethan Furman 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__:
No, it is much easier.
if __main__ if sys.version_info >= (3, 9) else __name__ == '__main__':
__main__ = __name__ == '__main__'
More information about the Python-ideas