Description
Originally discussed at #6348 (comment)
While I don't think it's necessary for the documentation to give every detail of the discovery process, this presumes that discovery is intuitive - and IMO, defaulting to an older version of Python when there's no python command on the PATH (and hence no "default Python" at the command line) is not intuitive. I don't think the existence of python3.x on PATH should ever influence the decision on what the default Python version should be - by having an explicit version in the executable name, it's by definition not used as a default...
I think the problem is we look for all valid Python executable names on the PATH one directory at a time. Instead, pythonX.Y
should only be used if we can't find any Python executable on the PATH with the name python
or python3
or if you specifically request --python X.Y
. This will be a little tricky to do in a performant manner, i.e., we don't want to list and parse the members of the directories on the PATH repeatedly.