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

David Mertz mertz at gnosis.cx
Wed Mar 11 21:03:36 CET 2015


https://www.python.org/dev/peps/pep-0394/
On Mar 11, 2015 12:44 PM, "Neil Schemenauer" <nas-python at arctrix.com> wrote:

> This has been brought up elsewhere, I think this is a better forum
> to discuss it.  Changing /usr/bin/python directly to python3.x is
> bad idea, in my option.  It's going to cause users trouble and the
> benefit to Python 3.x users is not worth it.  Instead, let's try to
> find a smooth migration path.
>
> One idea is to install Python 3 as /usr/bin/python but have it
> always execute scripts with Python 2 unless they are explicitly
> marked as Python 3 compatible.
>
> The interpreter could parse the first line of the script to look for
> options.  Traditionally the OS only passes the first option to the
> interpreter so anything after that could be used to pass 3.x
> specific options.
>
> For example, a script starting with
>
>     #!/usr/bin/python -x -3
>
> could signify that the script is compatible with a Python 3
> interpreter.
>
> An alternative idea is to allow something like the 'encoding'
> declaration.  It wouldn't have to be in the first line and would
> allow more flexibility.  Many years in the future when all scripts
> are marked as Python 3 compatible, Python 2 can be removed from the
> system and /usr/bin/python will start Python 3 by default.
>
> I suppose running '/usr/bin/python' interactively could start Python
> 3 by default.  However, I strongly feel that existing Python 2
> scripts should not get broken in a flag day like way.
>
>
>   Neil
> _______________________________________________
> 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/47ae6dbc/attachment.html>


More information about the Python-ideas mailing list