Python 3 from the perspective of a Unix sysadmin

December 17, 2011

I've been thinking about Python 3 for a while, mulling over things like how I feel about it and how likely I am to use it, and I've decided that one reason my feelings are complex is that I have three different views of it, from three different perspectives. Today is the day for the first perspective: Python 3 from the perspective of a Unix sysadmin who uses Python to program important parts of our systems.

I don't have any way to put this nicely, so I'll say it right up front: for a Unix sysadmin, Python 3 is currently highly radioactive and should be completely avoided. Our current systems are written in Python 2; there is no prospect of this changing and I am going to keep writing sysadmin things in Python 2 for the indefinite future. I will stop this only when the systems we use stop packaging Python 2, and I certainly hope that that doesn't happen for, oh, a decade or more.

The fundamental problem is that Python 3 wants the operating system environment to be Unicode, and Unix is not. When Python 3 comes into contact with messy reality, bad things happen and things fail. These failures are vaguely tolerable for ordinary user programs; they are intolerable for programs used for system management. I cannot afford to write programs that silently omit names from os.listdir()'s results, that don't see some environment variables sometimes, or that die with mysterious error messages if given the wrong arguments. There are workarounds for some of these issues (but none yet for the sys.argv issue), but they are limited in scope and unlikely to be pervasive (in, eg, third party modules that I want to use).

So long as Python 3 is busy denying Unix reality (and causing all sorts of complications as a result of this), the sysadmin side of me can't and isn't going to touch it. I doubt that the Python 3 developers care about this and I doubt that anything is going to change in Python 3, which is kind of a pity.

(I could probably write system tools in Python 3 if I wanted to and tried hard enough and had to, but I don't see any reason to do so given that Python 2 is there and going to be there for a long time to come. Python 2 works, it works without huge contortions, and I don't really see anything compelling in Python 3 so far.)

Sidebar: on the long term availability of Python 2

At this point in time I see essentially no prospect of Python 2 being removed from Linux distributions in the next five years (minimum). The very first step along the long path of removing Python 2 would be for distributions to migrate Python based system tools from Python 2 to Python 3, and that hasn't even started yet (distributions are just now starting to talk about maybe moving some of their Python-based tools to Python 3 for their next release).

The chances of Python 2 disappearing any time soon from more conservative and slow moving Unixes like FreeBSD and Solaris (and Mac OS X) are best described as 'laughable'.

Written on 17 December 2011.
« Avoiding the classic C quoting bug in your language
Understanding the close() and EINTR situation »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Sat Dec 17 02:59:31 2011
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.