Python’s Moratorium – Let’s think about this.

Since the news of PEP 3003 being released crossed the ‘web – I’ve seen more than a handful of assertions and statements made that seemed to grossly miss the point.notdeadyet.jpg

I figured I’d expound on my last post to further explain the why of the moratorium and some of the other personal reasons I stepped forward to help author it.

The one that really gets me is the assertion that the moratorium was some ego-driven “python is perfect” statement. That Guido/core dev think the language is “done” and that no new syntax or constructs are needed.

False. Categorically false. Quite the opposite is true. Most of us who are involved on python-dev and python-ideas and the various -sig lists are actually quite sure that some changes, whether they be syntactic sugar for existing things, or new fundamental constructs continue to be “needed” (“nice to have”) for Python The Language.

Still yet; many of us do think of new things to add – there is always a small wish list of “nice to have ponies” waiting in the wings to add to the language by a variety of people. So, no, no one asserts that “the language is done”. We all know, accept and look forward to the continuing evolution of the language over time.

However, language changes have side-effects. For example, context managers introduced two new keywords – “with” and “as” – you should take a moment to go back through the archives to see how many people were up at arms at those two new keywords being added. Apparently, a lot of developers use them as variable names.

To this day, I still download packages off of PyPI which throw warnings about those two keywords. Which is amusing, because they just crash under python 2.6. It was added to __future__ in 2.5 – but became syntax in 2.6.

I only mention this to illustrate the consequence of adding new things – does this mean adding new things is bad? No. Does it mean we have to be wary/aware of the ramifications of doing these things? Yes.

In the past 5 years, Python has gone through an accelerated evolution – decorators, context managers, etc. More new syntax, keywords and cool things have been added to the language than normally occurs in other languages. This has consequences.

The first consequence: Users. Users (developers) who want to support many version of python walk a tight rope. Ultimately, they have to write code for the lowest version (say, 2.3) and make sure their code doesn’t use anything (or any keywords) that will conflict with a newer version. That’s life – I think we, as developers, all accept that.

But the second one is more interesting. The second consequence is more of a recent development. For many years, CPython has been the implementation of Python. When you asked a person “hey, what python interpreter are you running” they typically say “the one from python.org” or “the one that came with my OS” – this is always CPython.

That’s changing. Take for example my surprise when I asked a friend “so what are you guys running” and his reply was Jython. He then lamented the fact that Jython was behind the curve on syntax changes in the latest version of Python, etc, etc.

More and more we see the fact that Python The Language is more than Python The C Interpreter. We have PyPy, IronPython, Jython, Unladen-Swallow (really, a branch of Cpython) and others. Sure, most of the community is still running good-old CPython (“old reliable”) but we’re at a point where more and more people are running “those other guys”.

We’re also at a point where some of the “cool” interpreter changes, such as JIT, free threading, etc are coming from those other interpreters. We face a possible future wherein CPython is just the reference implementation of the language, but most of the world runs “one of the others”. This is not a bad thing! It’s not that the CPython interpreter is dead – it’s simply that the other interpreters have a greater focus on “cool interpreter stuff” which CPython has a focus on “stable”.

Adding syntax, keywords, and new constructs to the CPython implementation negatively impacts those implementations. For the longest time, Jython was simply aiming at Python 2.5 compatibility – I’m sure us adding a pile of new things in every version doesn’t make their lives any easier. Sure, we can feel free to keep adding things in there, but without all of the implementations being at some parity with one another, every time we do so, and ship it, we set them back and possibly confuse users.

Now consider the fact that in the past 5 years, we’ve done a pile of releases, adding a bevy of features to the language, the latest and greatest being Python 2.6. Stop and realize for the moment most of the world is probably still running Python 2.4 or 2.5. Rumor has it, some people are still running Python 2.3. The fact is many operating system vendors, and normal people using python day to day, aren’t getting exposure to the latest and greatest things we’ve added. This means all the cool stuff we’ve added hasn’t seen the light of day – sure, some of it is “pretty minor” – but when you’re adding things to a language, you generally want to see them get used heavily so you know you “hit the mark” and don’t need to go and fix the thing you just added.

It’s important that we don’t (and shouldn’t) just chuck “really cool ideas” in there and then never look back – sure, some of them might be constructs from other languages which have been proven in that language but Python isn’t that language – Python is Python, and we have to be very self-aware to the consequence to Python a change might incur. It takes time, and adoption (see above) of those features to see how they stand up to real-world usage. Sometimes, we simply get an interface/API wrong, or the behavior isn’t as clear as we would like. It happens, but just adding thing on top of thing without taking a moment to consider how it worked out is bad.

Even with an extensive review/PEP process, even with some of the smartest people I have ever had the pleasure of talking to, mistakes happen. The only thing which allows us to see if a mistake has been made is time.

And now we get to Python 3.

Python 3 is an interesting animal – it breaks backwards compatibility in the name of forward progress – some of the changes made to the language required that break to occur. Now, throw a new, backwards incompatible version of Python onto the pile of things users, packagers, developers, OS Vendors, etc all have to deal with. Remember of course the point above – many people are still running/shipping python2.4/2.5. How are we going to get any runtime on the syntax we added in the 3.x line?

Python 3 is the ultimate syntax change – not to mention, to most users it’s several years off for them, given they’re reliant on third-party packages that haven’t ported, their OS doesn’t ship it, etc. For all the problems a “normal” python release suffers with adoption – Python 3 suffers from them in spades.

So now, we have Python 2.6, and Python 3 – both in the adoption pipeline. Python 2.6 is an easier pill to swallow, Python 3 is a bit more painful as it requires much more intervention to port to it, and maintain a compatible code base.

Let’s also account for the fact that, as of this writing, Python 2.7 (scheduled for next year) is intended to be the End of Life release of the Python 2.x syntax – Python 3 being the next evolutionary step.

Python 2.7 is going to be a good release – there’s going to probably be some Python 3 stuff pulled back into it to help porting to Python 3, there will be some “new” things – minor features back ported from Python 3 as well as more migration helpers to assist in the 2 to 3 jump.

Notice in that last part – almost everything going into 2.7 is a feature/change of Python 3 we’re pulling back to help developers and users alike. Big time features and changes are not typically going into 2.7. In fact, there’s a growing number of changes which are not being pulled back into 2.7, Antoine’s recent Global Interpreter Lock changes (also here) being amongst them.

I haven’t even mentioned the fact that every change to the code base has to go into at least 2 branches, and in many cases 4 individual branches (py26-main, trunk, py3k, py31-maint). Many changes don’t have a clean-merge, given the change of syntax each time you move something between trunk and 3k, you have a non zero chance of having to make decent changes to the patch you’re merging. This causes non-zero pain for core maintainers/developers.

So, here we are – a 2.6 release still being adopted by users, OS vendors, etc. A new 2.x release coming down the pike within the next year and a backwards incompatible release (Python 3) also in the pipeline.

At this point, it only makes sense to put a moratorium on the language – we have to artificially put on the brakes for the syntax and core language to make sure the next few releases (2.7, 3.2) don’t increase the burden for adopters. We have to let the other implementations catch up – we have to focus on things like stdlib improvements/fixes/cleanup, we can focus on interpreter improvements, tests, cleaning out the bug list, etc.

The next few releases of Python won’t introduce new language and syntax – they will be releases focused on bug fixes, cleanup – things that make everyone’s life better. This time will serve as a reflection period for the syntax we have, and allow us to help push along Python 3 adoption, maybe helping bigger projects port, improve porting tools and guides, etc.

I’d also like to add – this moratorium doesn’t apply to the standard library! We can still fix things like the mimetypes module, we can improve warts and fix things which are broken. We can keep cleaning the standard library up – we can polish all of those batteries which help make Python, well, Python. Ultimately Python isn’t just it’s syntax – many people adopt it because of the standard library (over 216 modules, at last count) – and that deserve as much, maybe more, attention than adding cool syntax to the core of the language.

So, don’t be afraid of it – don’t think that Python is evolutionarily dead – it’s not. We’re taking a stability and adoption break, a breather. We’re doing this to help users and developers, not to just be able to say “no” to every random idea sent to python-ideas, and not because we’re done.death.jpg

We’re doing it for you – the developer who needs stability, the OS vendor still working on a new release, the language/interpreter implementation group still catching up to 2.6/2.7 and to all the people who would like to adopt Python 3 in the next decade.

Python’s not dead people. It’s just outside sitting in the grass thinking about what it’s going to do next.

  • davidlegg
    Somebody sent me this link in an email with the title: 'Python is dead?'

    However, I think 'Python is a mess' would be more accurate :(
  • Then you're both wrong.
  • Andrew
    I don't like your writing style because it sounds authoritarian and like you're having a conversation with yourself excluding other voices. I read about the first third of the article before getting pretty frustrated and thinking "who is this dick?"

    I'm not even particularly interested in Python and came here via reddit
  • Thank you for the feedback; it's my blog though so you don't have to read it.
  • David Beazley
    Great article Jesse. I'd just like to add that from the Python training world, I encounter a LOT of programmers who are using older implementations such as Python 2.3 and Python 2.4. Generally, someone in their organization wrote a big piece of Python software using one of those versions and for various reasons, they're either not able to or unwilling to upgrade. To be honest, almost all of the new fangled features of Python 2.6 aren't even on the radar for these people. Python 3 isn't even on the same planet.

    So, I would just add that a moratorium is probably not a bad idea for most of Python's users as well. I mean seriously, what percentage of Python's users currently understand all of the new things that were simply added in Python2.5/2.6? Coroutines? Context-managers? Class decorators? Abstract base classes? Byte arrays? Having some time to simply learn about and digest what's already there will be good for the community.
  • Sorry - I thought I called that out, maybe I wasn't as clear as I meant it to be. That aspect is a big one - adoption in users of new releases is pretty slow. We, as technophiles, have to take that into account, those of us who adopt things on the bleeding edge are a minority of a minority.

    I think longer-time web developers understand this - people need to remember most web developer are still trapped with dealing with, and supporting Internet Explorer 6 - an ancient, crappy, no web standardy browser because many users are "just happy to get to the internets" or simply can't upgrade.
  • David Beazley
    Oh, I wasn't criticizing.... merely confirming what you're saying with my own experiences teaching Python in the corporate world.
  • I know! We're buds :)

    Really, doing some web dev recently has made me see things in a bit of
    a different light, figured I'd mention the IE6 thing. The funny thing
    is, after I made the post, a friend told me that the rapidity of the
    changes going into Python was one of the reasons he had been nervous
    about it.
  • Thanks for posting such a detailed and carefully reasoned argument. My gut feeling was that the moratorium was a good thing, and what you've said here simply strengthens that belief.
  • As long as we get the GIL eliminated yesterday, moratorium all you want ;-)
  • The GIL will eventually evolve, or die. Just not from the past - Guido has a time machine, it's not THAT good.
  • Performance wise python 3 does not bring anything new - like the much needed JIT compiler or rework the interpreter to remove the GIL. It just replaces one set of problems by changing the syntax, apis and stuff with a new set of problems, ironically, caused by the same changes.

    Adoption won't happen till either all the package maintainers get bored by your "switch to py3"-type blog posts like this and decide they can't stand that anymore ... or python3 brings convincing features to the table. The point is obvious.
  • Did you even click on the link to the GIL rework link? Or did you just come around to grind an axe or air a beef you have about you thinking Python 3 not bringing enough to the table? Because a fair number of us (and not just core maintainers) strongly feel Python 3 is a *better syntax*.

    That being said, we plan on continue to add things to Python 3 to make it more attractive a platform. Hence the part of my post where I said less and less is being pulled back into Python 2.7 from the py3k branch.
  • No, I didn't - I've read about it a month ago. Very good but not mind blowing. Faster GIL is still a damn GIL.
  • Yes, but it's an improvement, and a step in the right direction.
  • Ron Stephens
    Jesse, this is a great post, right on the money and clearly stated. I just want to say "amen" to one small phrase you threw in near the end:

    "helping bigger projects port"

    I think the biggest and best thing the core developers could possibly do, is to help port the NumPy library to Python 3. I know this would be a big sacrifice of time for the core developers, but it would help immensely.

    Ron Stephens, Python411
  • jamesthiele
    Well said. As a moratorium supporter +1.
  • Ron Stephens
    Jesse, this is a great post, right on the money and clearly stated. I just want to say "amen" to one small phrase you threw in near the end:

    "helping bigger projects port"

    I think the biggest and best thing the core developers could possibly do, is to help port the NumPy library to Python 3. I know this would be a big sacrifice of time for the core developers, but it would help immensely.

    Ron Stephens, Python411
  • totally agree with everything you said there... apart from a few people on the mailing lists I am not seeing any negative feeling towards to PEP3003. Most are totally unaware and running 2.3/2.4 and are just tired of me trying to convince them to use the features introduced in 2.5/6.
  • I've seen it a fair (not huge) amount. Then there's the negative feedback netted during the 3003 discussion. And then comments/other posts/etc. I actually started this post several weeks ago, but just got a chance to post it.
  • jackdied
    who is saying those things? Perhaps I don't spend enough time on the tech news sites like reddit and ycombinator (slashdot never covers python, and arstechnica occasionally does badly). I haven't seen those sentiments on planet.python.org where actual python users post.
  • andreyfedorov
    I said it: http://andreyf.tumblr.com/post/238634856/rip-py... (also discussed it a bit on news.YC)

    This post makes a lot of sense, and has largely changed my mind about it. I wasn't thinking of the whole Python ecosystem, just the language. The author is mostly right, I was wrong. Still, it would be much easier of a pill to swallow if the syntax were a lesser part of the language.
  • Thanks Andrey - your post wasn't the first (and I doubt the last) to make that supposition, but it was the one which spurred me to write this.

    I think that the syntax is a large part of what makes Python Python - if you strip away the syntax, and the standard library, what do you really have left? We're just trying to take a breather on the syntax to see how things pan out for Py3k and what we've already put in.

    I am interested to hear why I'm only "mostly" right :)
  • andreyfedorov
    Hah, "mostly right" mostly because I have an ego to protect, but also because of the importance-of-syntax sentiment.

    There's definitely more to a language than syntax and standard libraries: there are the metaphors which one uses to structure programs. In Python's case, generators are the most apparent metaphor not common to other languages. Yes, there exists an associated 'def...yield' syntax, but the syntax isn't what's important, the way one uses them to express problems is.
  • planet.python.org is a tiny subset of the python community, and a tinier sliver of the programming community at-large. I've personally heard this feedback in private email discussions, other blogs, etc. There's nothing wrong with attempting to address the ideas, and expound on the rationale of why I helped author the PEP :)
blog comments powered by Disqus