[Python-ideas] Migration of /usr/bin/python to python3

Gregory P. Smith greg at krypto.org
Wed Mar 11 23:41:47 CET 2015


I think /usr/bin/env is a bad idea to promote. It changes from an explicit
designation of what you need in order to execute to something being derived
from the users $PATH.  It is *less specific* than /usr/bin/python. For some
people that is the goal, but I discourage it.

I do agree with Donald (and Nick from the other conversation elsewhere)
that once this is framed as "the OS won't have Python 2.7 installed at all"
it is a much better idea: Yes, we will eventually need to update PEP 394 to
recommend under what circumstances /usr/bin/python -> python3.6 is
acceptable. (it should never change meaning on a given OS release based on
the packages installed and 2.7 won't be required for the default install
images so 3.x makes sense)

The harsh reality is that anyone who does not explicitly specify a specific
X.Y version of Python in their #! line via has effectively declared that
they do not care, consequences be damned.  If your code supports multiple
versions, fixing up the #! line to use the locally appropriate one is an
install time task.

-gps

On Wed, Mar 11, 2015 at 1:38 PM M.-A. Lemburg <mal at egenix.com> wrote:

> On 11.03.2015 21:03, David Mertz wrote:
> > https://www.python.org/dev/peps/pep-0394/
>
> I think the migration should start with modifying scripts to use
>
> #!/usr/bin/env python2
>
> when they are Python 2 only (*) and
>
> #!/usr/bin/env python3
>
> when they are Python 3 only and
>
> #!/usr/bin/env python
>
> only when they support both Python 2 and 3.
>
> "Explicit is better than implicit" and all that Zen :-)
>
> Once that's done, switching the symlink is really a no-brainer.
>
> The recipe for this is easy too:
>
> 1. replace all "#!/usr/bin/env python" with "#!/usr/bin/env python2"
> 2. migrate your scripts one by one to either Python 3.x or
>    to Python 2.7 + 3.4+
> 3. after migration replace "#!/usr/bin/env python2" with
>    "#!/usr/bin/env python3" or "#!/usr/bin/env python" resp.
>
> (*) Some OSes may require to use python2.7, if they don't come
> with a symlink from python2 -> python2.7.
>
> --
> Marc-Andre Lemburg
> eGenix.com
>
> Professional Python Services directly from the Source  (#1, Mar 11 2015)
> >>> Python Projects, Coaching and Consulting ...  http://www.egenix.com/
> >>> mxODBC Plone/Zope Database Adapter ...       http://zope.egenix.com/
> >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
> ________________________________________________________________________
>
> ::::: Try our mxODBC.Connect Python Database Interface for free ! ::::::
>
>    eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
>     D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
>            Registered at Amtsgericht Duesseldorf: HRB 46611
>                http://www.egenix.com/company/contact/
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150311/6c3a4ca1/attachment.html>


More information about the Python-ideas mailing list