|
|
Subscribe / Log in / New account

Python 3 is out - now what?

By Jonathan Corbet
December 10, 2008
For some years now, the Python development community has been talking about "Python 3000," the far-future release which would allow a complete rethinking of the language to fix the various annoyances which had built up over time. On December 3, that talk came to fruition with the Python 3.0 release. This release is the end result of a great deal of thought and development; it represents the vision Guido van Rossum and company have for the language into the indefinite future. Now that it's out, the Python community as a whole appears to have stopped for a "now what?" moment.

The wider Python development community appears to be split into three camps on Python 3.0; the situation amusingly resembles the classic folk tale "Goldilocks and the three bears." One set (the "too large" crowd) seems to think that an incompatible version of Python should never have been released, that languages should stay compatible forever. Another group ("too small") can handle the idea of an incompatible transition, but thinks that the Python community should have added more shiny features to the language while they were at it. And, of course, there's a "just right" crowd taking the position that the changes in Python 3 are just about as they should be. See this discussion by James Bennett for a well-argued description of the "just right" position.

Time will tell which position is closest to reality. If the "too large" group is right, Python 3 (or Python in general) will fade away as developers, unhappy with the break, move to a language they like better. If Python 3 is too small, there will be strong pressure for a Python 4 in the too-near future. Your editor, though, thinks that the Python community has come pretty close to getting it right. Things that truly needed to be fixed got fixed, but the Python developers resisted the temptation to try to do too much. They watched, from a safe distance, what happened with the Mozilla rewrite and Perl 6, and wisely concluded that their lives - and the lives of those who use Python - would be better if they avoided a similar experience. So they limited their goals and were able to get the job done in a reasonable amount of time.

Except, of course, that the job is not really done. To begin with, the presence of a few difficulties with the 3.0 release should not surprise anybody. The developers forgot to remove the deprecated cmp() function, with the result that newly-converted code may come to depend on it. There are some performance issues. A couple of other features are not working quite right. Getting Unicode truly straightened out may take a while yet - a problem which is certainly not unique to Python. The list seems to be quite short given that this is a major release of a complex programming language, but there are still things to fix. So there will almost certainly be a 3.0.1 release before the end of the year, and a 3.0.2 in (approximately) February.

Meanwhile, the Python hackers have made it clear that the 2.x version of the language will be supported for some years yet. Version 2.6, available now, includes a number of features aimed at making the eventual port to 3.0 easier. As the porting projects get serious, other ways to help that process will become clear; there will be an eventual 2.7 release which incorporates those lessons wherever possible. A 2.8 release further down the road has not been ruled out. The current plan seems to be to maintain Python 2.x for at least the next three years.

For many Python developers, it is not yet really time to make the jump to 3.0. That is good because, for many Python developers, it is not yet really time to make the jump to 3.0. The core language appears to be in reasonably good shape, but a language like Python involves much more than the core. Most non-trivial code makes heavy use of the wide variety of Python libraries, and, at this point, many or most of those libraries do not support Python 3. So, now is a good time for library maintainers to be looking at moving to 3.0, but application developers who try to port their code now are likely to run into frustration. Porting smaller programs or subsystems as an exercise in learning the new language may make sense, but complex application porting probably cannot happen for a little while yet.

What distributors should be doing is another question. So far, it would appear that only Fedora is having a (public) discussion on how to handle the Python 3 transition - see this thread - and they don't really know what they are going to do yet. Fedora's maintainers, it seems, would prefer to stay with Python 2 for the indefinite future; the chances of Python 3 making an appearance in Fedora 11 are quite small. There is a strong wish to avoid maintaining both 2.x and 3.x on the same distribution release; they would rather make a clean switch.

Your editor suspects that the flag-day approach to the language transition is not going to work. There are a lot of packages which need to be ported, and many of the people doing the porting would appreciate support from their distributor. Red Hat dragged its feet for a long time on the transition to Python 2, with the result that many users had to build and install the newer version of the language themselves. For Fedora to do the same with Python 3 is a sure path toward user frustration.

That said, keeping both versions of the language around is not a task for the faint of heart. Installing a different version of Python itself is quite easy. Keeping a whole set of modules for multiple versions is distinctly less so. This will be especially true for Fedora; some other distributions (especially the Debian-derived ones) have better mechanisms for (and experience in) maintaining multiple versions of core system tools. So the reluctance on the part of the Fedora developers to take on this work is thus unsurprising. Perhaps this would be a good opportunity for offers of help from the wider Fedora community.

It may well take a couple of years, but this transition will eventually be made and people will eventually wonder what all the fuss was about. And, when it's done, we'll have a cleaner, more maintainable, more Unicode-rational version of an important programming language to work with. That, one hopes, will be worth the short-term pain involved in getting there.

(For more information, see the Python3000 FAQ, currently under development).


to post comments

Comparing with Python 1.* - 2.*

Posted Dec 11, 2008 1:34 UTC (Thu) by dannyobrien (subscriber, #25583) [Link]

My feeling is that the move to Python 3 has pretty much the same life-cycle as the move from Python 1.5/6 to Python 2.0. It took a bit of time to move all the modules over to the new world, and there was no clear "flag day", but now it's incredibly rare to see a 1.5-only module.

The argument against this is that the Python ecosystem is now far larger and mature to manage a similar transition, but honestly I think that is overstating Python's presence in the world for now. It's still growing, but the number of libraries and interdependencies is really not as great as, say, C++ or even Perl. I think in 6 years, python 2.0 will be as historical an oddity as Perl 4 (and Python will still be around, I hope).

Python 2 & 3 on the same machine not so painful

Posted Dec 11, 2008 2:02 UTC (Thu) by leonov (guest, #6295) [Link] (3 responses)

I may be missing something obvious here (I've taken the final release of Python as a chance to [finally!] learn a language I've heard so many good things about), but keeping multiple versions of Python around seems pretty painless:

Your library modules go into a versioned directory by default, eg.
/usr/lib/python2.5/
/usr/lib/python2.6/
/usr/lib/python3.0/

And you have a versioned executables:
/usr/bin/python2.5
/usr/bin/python2.6
/usr/bin/python3.0

Presumably you use a symlink to pick your default version:
/usr/bin/python -> /usr/bin/python2.5

Scripts written for various versions can coexist on the same machine simply by using different 'hash bang' lines:
#!/usr/bin/env python2.5
#!/usr/bin/env python2.6
#!/usr/bin/env python3.0

Of course, it would probably be a good idea for a distribution to standardise on the the same python version for all of their own scripts, but it's nice to have packages of different versions available for development and backwards compatibility purposes...

Using it is not a big deal, packaging it is

Posted Dec 11, 2008 7:07 UTC (Thu) by khim (subscriber, #9252) [Link] (2 responses)

While it's true that it's trivial to use pre-packaged version of python it's not so easy to coerce python modules to play nice with few versions of Python. Installation scripts for a lot of packages out there presume /usr/bin/python is symplink to THE python you are using and refuse to support anything else. Debian copes with it, but it has the whole build infrastructure to do so: development packages will be installed removed on "as-needed" basis and as you've pointed out there are no problems with the built packages. Fedora have no such infrastructure: they just install EVERYTHING on build system and go from there. To develop such infrastructure just for python looks like an overkill to me...

Using it is not a big deal, packaging it is

Posted Dec 11, 2008 8:40 UTC (Thu) by nim-nim (subscriber, #34454) [Link]

This has not been true for many years (see mock, plague and koji). Fedora packages are built in an environment that only includes the dependencies the packages declare.

The problem is not so the plumbing or infrastructure as having people willing to package and maintain X versions of the same python modules (fighting against the upstream build scripts all the time).

It does you little good to have half your python stack one side, and half the other.

Using it is not a big deal, packaging it is

Posted Dec 11, 2008 9:53 UTC (Thu) by __alex (guest, #38036) [Link]

Debians "coping" with multiple Python versions is more like just ignoring the problem entirely and hoping no on will notice. easy_install-2.5 doesn't even work. This would be livable but there are hardly any modules for 2.5 in etch anyway and you end up having to install things from source constantly.

Python 2 now stable

Posted Dec 11, 2008 2:25 UTC (Thu) by ncm (guest, #165) [Link] (2 responses)

This is good news. It means that we can write Python 2.6 code that will always run on every future release of Python 2. Incompatible point releases are a thing of the past.

Someday Python 3 will be stable enough to write code for, but there's no reason to port any application from Python 2. Libraries will end up getting ported, and useful for new applications. Eventually when 3.x settles down (about 4.0 time, I imagine) it will be time to start writing apps for that stable 3.N. Some sad sacks will be obliged to use Python 3, and keep porting to subsequent 3.x|x<N, because of new libraries that haven't been backported to 2.6. They'll help stabilize it and prepare it for serious use.

This is all according to plan.

If history is any indication...

Posted Dec 11, 2008 7:10 UTC (Thu) by khim (subscriber, #9252) [Link] (1 responses)

Library writers are happy to jump to new version of any language. Months after python 2.5 was released first "python 2.5 only" libraries started to appear - and I fail to see why python 3.0 will be any different. I certainly will not switch all my scripts to python 3.0 right away but if I'll start anything new today - I'll do it with python 3.0: why feel the pain of incompatible switch down the road if you can start with newer version from the beginning?

If history is any indication...

Posted Dec 17, 2008 7:09 UTC (Wed) by kbob (guest, #1770) [Link]

More importantly, why would you want to keep living with Python 2.0's warts? Pythonists are much more sensitive to issues of cleanliness than programmers of most languages *cough*Perl*cough*, so I expect the migration to happen pretty quickly.

Python 3 is out - now what?

Posted Dec 11, 2008 3:55 UTC (Thu) by kev009 (guest, #43906) [Link] (3 responses)

"For Fedora to do the same with Python 3 is a sure path toward user frustration. "

I think it's kind of unfair to place all the pressure on Fedora. If anything, we will probably see it in Fedora first with Redhat devs doing a lot of heavy lifting (though Ubuntu will release a week before and take all the credit - not like they didn't do that with NetworkManager, 3G wireless, or anything.). Fedora is actually the only distro I can think of besides the source ones where problems like this are actively worked out.

You also left out a critical detail. Python 2.6 was released almost simultaneously, the goals being: 1) backport important features and 2) ease porting when that "flag day" comes.

It is likely that the cutting edge distros will move to 2.6 with the current release cycle. Depending on how that goes, we could see 3.0 in the next iteration. That would mean a timetable of less than 12 months...

Python 3 is out - now what?

Posted Dec 11, 2008 7:43 UTC (Thu) by nlucas (guest, #33793) [Link] (2 responses)

You haven't read the article right. Ubuntu is a "Debian OS", so it already supports multi-python versions since the 1.x/2.x times.

Fedora needs to actively work it out because it never did this in the first place.

Python 3 is out - now what?

Posted Dec 11, 2008 8:46 UTC (Thu) by nim-nim (subscriber, #34454) [Link] (1 responses)

Pushing X versions of the same packages is the easy part (as Linus often mockingly writes, "it builds, what can go wrong")

Standing for them, and helping bugs get fixed upstream is another.

Fedora has so far refused to dilute this kind of QA work between several Python versions.

BTW in case someone felt Fedora was too conservative Python-wise, major python packages such as Plone or Zope are not in Fedora because their authors still have not made the effort to port to the python versions Fedora uses.

Python 3 is out - now what?

Posted Dec 11, 2008 10:40 UTC (Thu) by nlucas (guest, #33793) [Link]

I wasn't saying one method was better than the other. Just stating a fact.

As I don't program in Python I let that kind of decisions to those who actually know what they are doing.

Python 3 is out - now what?

Posted Dec 11, 2008 7:43 UTC (Thu) by keybuk (guest, #18473) [Link] (2 responses)

Ubuntu 8.10 released with a beta of Python 3 available in the archive (as has Debian):

apt-get install python3

Ubuntu 9.04 (currently in development) will almost certainly have 3.0.x

It's completely parallel installable, and modules can be found in the python3-* packages.

No need for any migration flag days.

Python 3 is out - now what?

Posted Dec 11, 2008 8:58 UTC (Thu) by kov (subscriber, #7423) [Link]

Right, but there will be a flag day to make python3 become /usr/bin/python, I bet.

Python 3 is out - now what?

Posted Dec 12, 2008 3:06 UTC (Fri) by pabs (subscriber, #43278) [Link]

Err, Debian doesn't have python3 at all:

http://packages.debian.org/search?keywords=python3

Python 3 is out - now what?

Posted Dec 11, 2008 9:33 UTC (Thu) by DeletedUser32991 ((unknown), #32991) [Link] (2 responses)

At least Python 3 is overtly incompatible. When Debian switched to Python 2.5 (from 2.4) as default, lots of breakage (~50 third-party libraries) was still left despite python 2.5 being included for quite a while, some less subtle (like the the memory allocation funny stuff), some more subtle and varied (e.g. SOAPpy error handling breaking because the some objects became new-style classes for inheriting Exception).

Incompatibility within Python 2.x

Posted Dec 11, 2008 17:45 UTC (Thu) by rfunk (subscriber, #4054) [Link] (1 responses)

This sort of thing is one of the reasons I decided to stay away from
Python. It seemed like every minor release had major backward
compatibility problems. When I noticed this I was mostly programming in
Perl, which has done a good job of maintaining backward compatibility in
5.x.

Of course, these days I prefer Ruby, though it has had some compatibility
problems between 1.8.x releases. :-/ (But similar to Python, it has a
new 1.9.x release that's explicitly incompatible.)

Incompatibility within Python 2.x

Posted Dec 18, 2008 13:28 UTC (Thu) by pboddie (guest, #50784) [Link]

This sort of thing is one of the reasons I decided to stay away from Python. It seemed like every minor release had major backward compatibility problems.

More familiarity may have demonstrated to you that major problems have actually been quite rare. I'm fairly unimpressed with Python 3, and I'm disappointed that changing the language was done in preference to a lot of other things which seem more important (at least to me), but until now Python has had a relatively good compatibility record.


Copyright © 2008, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds