Dec 4 2008

Python 3.0: What’s The Point?

Python 3.0 is finally out. I like Python (though it and Ruby are always competing for my affections), and I’m always a sucker for new features in any language, but I’m having trouble getting excited about this. Despite the longtime code-name “Python 3000”, it doesn’t seem very futuristic; and it introduces a lot of compatibility problems. In fact, after reading the docs, I can’t come up with any good reasons to install or use the new version. Am I missing something?

Looking at the official What’s New page, my takeaway is that the benefits are:

  • A bunch of minor language features cleaned up
  • Better (at least less confusing) Unicode support
  • Some nice but minor new syntactic features

while the drawbacks are:

  • Won’t run any pre-existing Python software. Just one minor example: the xrange() function no longer exists; instead, range() behaves the way xrange did. I’m pretty sure I’ve written something like “for i in xrange(a,b)” in every significant Python program I’ve ever written, causing all of them to break in 3.0 until I update them. Which is trivial; but there are dozens and dozens of changes like this. And many of them won’t cause easy-to-diagnose exceptions like the removal of xrange; some just cause subtle changes in behavior that will likely require debugging if they’re overlooked. (There is apparently an automated code converter, but of course it won’t fix everything.)
  • As a side-effect of the above: All existing Python books are now out-of-date. (Sure, much of each book’s coverage is still accurate, but the reader who’s not a Python 3 expert already won’t know which parts are OK and which are now wrong.)
  • Programs written for Python 3.0 probably won’t run in any earlier version of the interpreter, since most of the changes aren’t backward-compatible.
  • Slower performance: “Python 3.0 runs the pystone benchmark around 10% slower than Python 2.5.”

Something seems wrong here! the benefits are minor, the drawbacks are huge. Where’s the incentive to use it?

Compare this to the Ruby 1.9 story: A number of language improvements; they’re mostly backward-compatible, although with enough exceptions to break lots of large apps like Rails). But oh yeah: it’s three times as fast. That’s a very big deal, considering the poor performance of today’s Ruby (and Python). Once the 1.9 tech appears in a stable release, I am definitely upgrading.

Or compare to an operating system upgrade. How would you respond to a pitch like: “The ‘Meerkat’ release is going to be incredible! We’ve made a number of improvements to the system libraries. Of course, all existing apps will break, so you’ll have to get upgrades from the developers (which won’t run on earlier OS’s, by the way.) And afterwards you’ll notice everything running 10% slower! But we’re sure you’re going to love the enhancements to iterators and Unicode support…”

So what did I miss? I don’t mean this as an attack; I’m just genuinely confused…

Update: See also my further thoughts in response to James Bennett’s article.


90 Responses to “Python 3.0: What’s The Point?”

  • Paul Boddie Says:

    As you yourself mention, there will be more backports. So in fact, they will have *increasingly* related implementations from now on.

    This assumes that all major enhancements to the Python 3.x implementation will be backported, which I seriously doubt will be the case. There will come a time when people will decide that it’s not worth backporting stuff to 2.x, the hope being that no-one will care about 2.x at that point.

    And it’s not two different languages. There are a set of changes done that are done in a backwards incompatible way. That doesn’t make it two different languages.

    What should we call them, then? Dialects? I don’t think euphemisms soften the blow, personally.

  • Patrick Says:

    Thanks all for participating. All that was very interesting and I even learned some things here and there.

    Since we won’t be moving to 3.0 for a long time because we depend on a number of large libs like Numpy, Twisted, Beautiful Soup, Wx, SQLAlchemy, etc, I am only hoping that the large amount of visibility the 3.0 release is generating will get the lib developers to at least publish their 3.0 plans. I often can’t tell if they plan to get to 3.0, or when, whether it be 6mo. or 5 years. This makes me feel like I’ll wake up in three years and ask myself whether I should look at this situation again to see if it’s time to get serious about 3.0 with our codebbase or not.

  • Lennart Regebro Says:

    Paul: “This assumes that all major enhancements to the Python 3.x implementation will be backported”

    No, it assumes that more of the enhancements will be backported than new ones added, which is exactly what will happen.

    “There will come a time when people will decide that it’s not worth backporting stuff to 2.x, the hope being that no-one will care about 2.x at that point.”

    Yes, obviously the goal is that 2.x in the long run will become less used.

    “What should we call them, then? Dialects? I don’t think euphemisms soften the blow, personally. “

    It’s still the same language, the syntax differences are small (but incompatible). The standard library has been reorganized, but that hardly makes it a different language. Different versions of Basic has bigger differences than this. Different versions of C is more incompatible than this.

    Patrick: “This makes me feel like I’ll wake up in three years and ask myself whether I should look at this situation again to see if it’s time to get serious about 3.0 with our codebbase or not. “

    Well, one or two years, I would guess, but otherwise you are spot on.

  • David Daniel Hofmann Says:

    my 2 cents

    You can no rely forever in something that was good enough 20 years ago

    And as always, it is just a matter of time to improve performance, and about compatibility issues, actually should be see as an opportunity to migrate to a better API :)

  • DRY Says:

    Dear All above,

    I pray Python 3.0 be made to have good “execution speed” urgently !

    As a python user, I don’t care for some small stupid corrections that bother the super brains of the language. I just need the following in python 3.0 and its related areas of applicability:

    a) Speed
    b) Pyhton Browser plug-in like the JRE-plugin in all browsers for graphics

    Speed, Speed and Speed are important for me and majority others in application development area. I hate C code to be put in python and do a double job for speed. Thats why most people hate python. Even Psycho, pypy don’t match Java 6 speed. Perl is still in market due to speed. Ruby 1.9 is thought to be faster than earlier versions.

    I tell u an animal story. Some animals in savannah survive by shear strength (king of beasts) , some survive at both own and other’s strength, some survive by intelligence and speed, some by having great features that help them adapt to the conditions of savannah.

    Finally, there was one animal that had little physical power but was incredibly fast in catching its prey. This made it survive over a million years in savannah. That is none but Acynonyx jubatus(Cheetah). They have no fear of king of beasts due to their speed.

    In an analogy, I understand that Java is king of languages. Perl a Wild Dog (intelligence and speed), Python and Ruby as part-time scavengers - partly depend on C/Java in various applications, C/C++ as OS dependant fast languages (with features adapted for a particular OS) and now we want a language like the cheetah —> Enough power + speed.
    PHP filled that for web applications but what about non-web applications?

    Python is incredibly powerful language with smaller set of core language. It is slender and does most tasks what we want. Even though it is slender, it is suprisingly slow!!!! and most stupid authors of articles, write that —“optimize the algorithm first then identify the essential parts where there is a speed lag. Write those areas in C etc….”.
    Do, we need two different animals to kill the same prey?? Do we need to Scavenge on JVM using Jython and/or JRuby. Where is the identity gone? Two languages cannot have a “equal symbiotic” relationship due to their different development policies. Why depend much on other languages?? Java did a right thing to bring all together to one platform and is ruling (better than C#) like a king.

    Python needn’t fear java if it has faster run-time. As per animal rules, If python is not having speed nor highest power, it must survive due to a group. That is what I call python community.

    I will get back to python 3.0 only when its speed is near to Java 6. (Or atleast even if it’s speed is twice slower than Java). Python is a gr8 language with many good features but success depends on speed !!Does this get to the brains of people developing python versions!!

    Quote: “You shudnot market urself much. Other’s shud acknowledge that u r gr8” (This is what people call Java).

    Regards,
    DRY

  • rich Says:

    I think cheetahs are going extinct — limited genetic diversity.

    I am not overly worried about python 3.0, happy it is being done, and will make my way over there on the slow train, after numpy etc.

  • DRY Says:

    >>>>>I think cheetahs are going extinct — limited genetic diversity
    Agreed for limited genetic diversity but atleast there are conservation efforts rather than wiping off. Python still doesn’t have speed. So no conservation efforts. Language will get wiped off.

    >>>>>I am not overly worried about python 3.0, happy it is being done, and >>>>>will make my way over there on the slow train, after numpy etc.
    By then you expire from job

    DRY

  • Will S Says:

    I’m a geologist (used to be a programmer in the early 90s) and I’ve been dabbling in Python for a few months…programming isn’t my primary function by any means. So far, I’ve bundled a few small programs in data releases. However, this switch from 2.x to 3.0 means that the hours I’ve invested in learning Python have been largely wasted…I don’t have time to learn new ways of doing old things (print x, print () wtf, wtp?) At this pointed, I’m opting to retain Python at my current level for simple scripting and sharpening my Java for “real” programming. I need a *stable* language - I have too much to learn and keep up with to continually relearn programming languages. I’m probably not the only one.

    Personally, I don’t think that Python is popular enough or transparent enough to maintain two separate versions that require two separate support packages.

  • Lennart Regebro Says:

    “However, this switch from 2.x to 3.0 means that the hours I’ve invested in learning Python have been largely wasted…”

    No, it doesn’t. Python 3 is not another language. It’s still the same language.

    “I don’t have time to learn new ways of doing old things (print x, print () wtf, wtp?) “

    See, you already HAVE learnt that difference.

  • Leo Murch Says:

    @DRY

    Further to your statements, I wish to add “Python has lame Optimization” and “Small Job market”.

    Some mentioned in their sites, “Pythoneers Facing mid life crisis for job”

    Leo