On Wed, Mar 11, 2015 at 2:43 PM, Neil Schemenauer <nas-python@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.
So Python 2 needs to be there anyway?
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.
What about using */usr/bin/env*? That wouldn't work; on my Linux system, */usr/bin/env* doesn't like any command like arguments. Whenever I download a Python program, I usually check the hashbang to see if it works with Python 2 or 3. This is bound to cause confusion, since a quick glance would say "hey, this looks like it works under Python 2", followed by the error-fest.
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 guess that's better.
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.
But parsing hashbangs really isn't the answer. It's just really Perl-magic-ish confusing.
Neil _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/
-- Ryan [ERROR]: Your autotools build scripts are 200 lines longer than your program. Something’s wrong. http://kirbyfan64.github.io/