[Python-Dev] Another update for PEP 394 -- The "python" Command on Unix-Like Systems

Victor Stinner vstinner at redhat.com
Wed Feb 13 11:20:55 EST 2019


I'm a (strong) supporter of providing a "python" command which would
be the latest Python version!

As php does nowadays (after previous issues with "php4" vs "php5".) I
don't recall that perl had "perl4" vs "perl5", the command was always
"perl", no? Same for Ruby: it was still "ruby" after for Ruby 2, no?
Only Python and PHP used different program names depending on the
language version, no? And PHP now moved back to a single "php"

In the container and virtualenv era, it's now easy to get your
favorite Python version for the "python" command.

On my Windows VM, "python" is Python 3.7 :-) In virtual environments,
"python" can also be Python 3 as well.

I recall that I saw commands using "python" rather than "python3" in
the *official* Python 3 documentation: see examples below (*).
Problem: On Windows, "python" is the right command. "python3" doesn't
work (doesn't exist) on Windows. Should we write the doc for Windows
or for Unix? Oooops.

There was an interesting discussion about the Python version following
Python 3.9: Python 3.10 or Python 4? And what are the issues which
would make us prefer 3.10 rather than 4.0?

One practical issue is that right now, six.PY3 is defined by "PY3 =
sys.version_info[0] == 3" and so "if six.PY3:" will be false on Python

Another interesting thing to mention is the Unix Python launcher
("py") written by Brett Cannon written in Rust:

(*) A few examples of "python" commands in the Python official documentation

"$ python prog.py -h"

"$ python logctx.py"

"python setup.py install"

"python --help"

"python setup.py build"

"exec python $0 ${1+"$@"}"

"python setup.py --help build_ext"


Le mer. 13 févr. 2019 à 16:49, Antoine Pitrou <solipsis at pitrou.net> a écrit :
> On Wed, 13 Feb 2019 16:24:48 +0100
> Petr Viktorin <encukou at gmail.com> wrote:
> > PEP 394 says:
> >
> >  > This recommendation will be periodically reviewed over the next few
> >  > years, and updated when the core development team judges it
> >  > appropriate. As a point of reference, regular maintenance releases
> >  > for the Python 2.7 series will continue until at least 2020.
> >
> > I think it's time for another review.
> > I'm especially worried about the implication of these:
> >
> > - If the `python` command is installed, it should invoke the same
> >    version of Python as the `python2` command
> > - scripts that are deliberately written to be source compatible
> >    with both Python 2.x and 3.x [...] may continue to use `python` on
> >    their shebang line.
> >
> > So, to support scripts that adhere to the recommendation, Python 2
> > needs to be installed :(
> I think PEP 394 should acknowledge that there are now years of
> established usage of `python` as Python 3 for many conda users.
> Regards
> Antoine.
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/vstinner%40redhat.com

Night gathers, and now my watch begins. It shall not end until my death.

More information about the Python-Dev mailing list