On Thu, May 28, 2020, 3:06 PM Chris Angelico <ros...@gmail.com> wrote:

> 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.
>

I take back my comment. I think I may have used the multiple __main__
blocks occasionally, for reasons Chris notes. Like I want something
configured BEFORE a function is defined (maybe a global that only makes
sense when run as script).

However, I haven't done it for a long while. I think when I was younger I
didn't value encapsulation sufficiently. That said, I don't want the
capability to change. There are lots of things I don't do stylistically,
but I don't want striken from the language.
_______________________________________________
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/FPDFDFM66BZSHPYM3ZNYHEMZ4PTR5T3L/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to