> Also see PEP 299 for a slightly different approach.

Indeed. This proposal is more limited in scope than PEP 299, and appears
better from a backwards compatibility perspective.

> there's going to be two ways to spell the exact same thing. Both are
> still going to have to be memorized

Sure - though ideally over time the more verbose spelling will become
less idiomatic, and new users will encounter it less, and learners won't
need to memorize it because they won't need it and won't see it. Granted
there would be several years between the new feature being introduced
and when it is supported ubiquitously enough that the more verbose
spelling becomes rare.

> In a huge number of cases, it's actually better to separate out the
> library-like and script-like portions into separate files, or some
> other reorganization.

Other than the note about multiprocessing's spawn mode, I personally
agree with this. But still: this is extremely heavily used.  There are
almost 32 million hits for this idiom on GitHub:
https://github.com/search?q=%22__name__+%3D%3D+__main__&type=code

It seems that many people find value in this, and so lots of new users
continue to be exposed to it.

> Generally, I think scripts in installed packages are better handled
> via setuptools entrypoints nowadays.

In my experience, people reach the point of splitting their own scripts
out into private modules long before they reach the point of packaging
things. I propose this because I think it makes a gentler path for
learners. Pushing them in the direction of setuptools instead gives them
a brand new hurdle to overcome, one that's even more complex than the
rote memorization I'd like to see overcome.
_______________________________________________
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/PDJC3G36SOD6M5TEOKWCCHUASFWTTA5H/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to