[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /usr/bin/python in Python 2 and 3



On Tue, 21 Apr 2015, Dmitry Shachnev wrote:

To be honest, I don't like this proposal.

- Newly written code should *just* use Python 3 (there are exceptions, but
 very few).

- If existing code supports Python 3, and its developers consider Python 3
 as a target platform, then it should *just* use python3 shebang.

 Python 3 appeared seven years ago (at approximately the same time as
 Python 2.6, which is the minimal version for most bilingual code), so it
 is available almost everywhere. When the proposed PEP is accepted[1] and
 adopted by the distributions[2], the probability of *not* having Python 3
 will be close to zero.

I agree with these, mostly. However, it's worth noting that "almost everywhere" today does not include, for instance, even the latest version of Mac OS X. Given how long it's been since Python 3 is out, are we confident that other OSes will add Python 3 by the next Debian release?

For third parties who want to distribute scripts that run out-of-the-box everywhere (installers, cross-platform system management or monitoring scripts, build scripts, etc.), Python 3 isn't an option. If we remove Python 2 from the default install in Debian, Python 2 ceases to be an option too. So they'll start using sh or perl or something, or ship compiled code, both of which I think are net negative options.

- Existing code that has not been ported to Python 3 should continue to work
 (with Python 2), without any changes to it. These three cases cover most
 of the Python code.

This will probably cause all Debian systems in practice to get Python 2 installed on them at some point, with the possible exception of embedded / appliance-y systems that run one application and nothing more. If that's something we're fine with, sure (and it avoids the work of convincing third parties to add the pyversions= header and porting and testing on both versions).

One other point that I glossed over: the interactive command "python" currently runs either Python 2 or nothing. Would we like it to run Python 3 at some point? If end users do this on their own via a symlink (which is very tempting) they'll get mysterious failures from certain third-party applications.

A simpler version of the proposal is that interactive use (no arguments, and isatty(0)) always launches the latest Python interpreter of any major version, but all other use always launches the latest Python 2 interpreter, or prints an error message.

--
Geoffrey Thomas
https://ldpreload.com
geofft@ldpreload.com


Reply to: