On Fri, May 29, 2020 at 2:32 AM David Mertz <me...@gnosis.cx> wrote:
>
> On Thu, May 28, 2020, 12:17 PM <jdve...@gmail.com> wrote:
>>
>> The OP is proposing as a possibility: "we could require user to have only 
>> one if __name__ == '__main__':". In that case, functionality will be 
>> reduced, won't it?
>
>
> I don't support the proposal. However, I've also never written a script with 
> multiple 'if __name__ == __main__' lines, and I think if I saw one I'd 
> complain in code review.
>
> It's hard for me to imagine how multiple entry point to a script can be a 
> good thing.
>

There aren't multiple entry points, though. There would be multiple
blocks of code that are skipped if the module is imported, but
executed if it's run as a script. Remember, Python code is NOT
declarative. That 'def' statement is an actual executable bit of code.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/743C6XJ2DYARWCG4VVI62APXRELZKNVR/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to