Use ‘python2’ or ‘python3’, explicit is better than implicit (was: l = range(int(1E9)))

Ben Finney ben+python at benfinney.id.au
Thu Apr 30 19:19:57 EDT 2015


Chris Angelico <rosuav at gmail.com> writes:

> Very easily and simply: Python 3 and Python 2 will always install
> separately, and the only possible conflicts are over the "python"
> command in PATH and which program is associated with ".py" files.

Using the ‘python’ command is now ambiguous, and with Python 2 slipping
inexorably into the past, increasingly the ‘python’ command is the wrong
choice for Python programs that we want to survive in the future.

I am seeing a growing call, with which I agree, to recommend explicitly
calling ‘python2’ or ‘python3’ as commands.

That includes when we type it for direct one-time invocation, or when we
set it as the command for automatic execution of a program (e.g. in the
“shebang” line of a program).

Use the command ‘python2’ or ‘python3’ to be explicit about which Python
version you intend to run. Legacy programs will continue to work, and
code targeting Python 3 will not accidentally get an incompatible Python
2 interpreter.

-- 
 \      “I don't want to live peacefully with difficult realities, and |
  `\     I see no virtue in savoring excuses for avoiding a search for |
_o__)                        real answers.” —Paul Z. Myers, 2009-09-12 |
Ben Finney




More information about the Python-list mailing list