Python Developer Survey: Python 3 usage overtakes Python 2 usage

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sat Mar 31 06:00:35 EDT 2018


On Sat, 31 Mar 2018 12:39:48 +0300, Marko Rauhamaa wrote:

> Paul Rubin <no.email at nospam.invalid>:
>> All the scripts that say #!/usr/bin/python at the top will still use
>> python2.
> 
> Which is how it should be till the end of times.

Don't be silly -- they should use Python 1, of course, as nature 
intended. In 20 years time, when we're using Python 5.2 and Python 3 is a 
distant memory, typing "python" at the command prompt should try to 
launch Python1.x.

If you think that's ludicrous, consider that replacing 1.x with 2.x 
doesn't make it any less ludicrous.


> Unfortunately, ArchLinux decided otherwise, which has caused quite a bit
> of grief in the office, where a coworker uses it.
> 
> We thought we could get around the problem by specifying
> 
>    #!/usr/bin/env python2
> 
> in all of our scripts, but, regrettably,
> 
>    (1) Not all of our python tools are written by us

Nevertheless, they're text files on your server which can easily have a 
tiny sed script run over them as part of the deployment process, or a 
thin wrapper in bash, or your tech staff could add an alias to their bash 
login script (or equivalent).

Or just get the Archlinux guy to add an alias to his logic script.



>    (2) MacOS doesn't have a python2 alias for Python2

o_O

Um... is your tech team made up of actual techs or do you ask your 
grandma[1] to administrate your system? How hard is it to add a python2 
alias on MacOS?

That's a rhetorical question -- the answer is, "not hard at all".




[1] For all I know, Marko's grandma could have invented Unix. If that's 
the case, substitute my grandma, who certain did not.



-- 
Steve




More information about the Python-list mailing list