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

Donald Stufft donald at stufft.io
Wed Mar 11 21:14:14 CET 2015


What's worse. Breaking everything that uses an unversioned shebang because /usr/bin/python doesn't exist or breaking some things that doesn't work with Python 3 because /usr/bin/python is now 3?

Generally discussions along this line talk about Python 2 not being installed by default at all (whereas Python 3 would be). So really it's two different broken by default.


> On Mar 11, 2015, at 3:43 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/


More information about the Python-ideas mailing list