On 9 March 2016 at 14:06, Alexander Walters email@example.com wrote:
On 3/8/2016 23:05, Chris Angelico wrote:
Have a read of PEP 397 if you want to know why the launcher exists.
But who does that actually help? I contest this attempts to solve a problem (in the wrong way) that does not actually exist.
Volunteers don't generally donate their time to solve problems they don't have (and employers don't typically donate their employees' time to solve problems they or their customers don't have), which means "I don't personally have that problem, so I deny its very existence" is almost never a compelling line of argument in a community-driven open source project.
In this case, we needed a cross-platform way for Python 3 scripts to indicate they were Python 3 only, and Python 2 scripts to indicate they were Python 2 only. *nix already had a way to indicate that via shebang lines, so it was natural to make that existing solution also work on Windows, rather than inventing something Windows specific (which would rather defeat the "cross-platform" objective). The fact that the chosen implementation strategy also made the "py" launcher usable at the command line was more of a side effect than the primary purpose of the exercise.
In that regard, I think the meaning of "Make py.exe default to Python 3" as proposed in this thread needs to be spelled out more explicitly. If the proposal is to change the default behaviour for:
* launching the interactive interpreter * running scripts without a shebang line * running scripts with an unrecognised shebang line
then I think it's reasonable to switch all those to default to the newest CPython runtime on the machine, regardless of whether that's Python 2 or Python 3.
However, if the proposal is also to change the handling of the following shebang lines:
* #!/usr/bin/python * #!/usr/local/bin/python * #!/usr/bin/env python * #!python
then I think those should continue to be handled in a manner consistent with PEP 394 (and as PEP 397 currently specifies): as referring to Python 2 (unless PY_PYTHON explicitly says otherwise or only Python 3 is available).
Independently of the main topic of the thread, it does sound to me like there may be a valid enhancement request for the Windows installer to add a "Repair" mode that allows some of these settings (like adding or removing the file association) to be changed post-installation.