The Python 3 transition changed my perception of Python. My early experience of Python was good. Learning how to write good tests in Python made my Python code better. But the transition to Python 3 lost me as a Python advocate.
I still write occasional simple scripts in Python; with Plumbum it’s my preferred replacement for shell scripts that need to do anything interesting with data or have careful error handling. I still like list comprehensions for expressing the structures of the data in the code; something I picked up long ago learning Scheme. I think that Jupyter has contributed to making Python the language of data exploration, which is great.
But the management of the Python 3 transition has diminished Python from my language of choice to my replacement for Perl.
Gregory Szorc’s Mercurial’s Journey to and Reflections on Python 3 (h/t LWN) is full of concrete, specific facts and then goes on to reflect in some Commentary on Python 3 at the end. A lot of the reflections ring true for me, as someone who started with Python 1 and wrote a lot of Python 2 code. Here are just a few quotes that resonated most strongly:
Succinctly, my experience porting Mercurial and other projects to Python 3 has significantly soured my perceptions of Python. As much as I have historically loved Python - from the language to the welcoming community - I am still struggling to understand how Python could manage to inflict so much hardship on the community by choosing the transition plan that they did. I believe Python’s choices represent a terrific example of what not to do when managing a large project or ecosystem. Maintainers of other largely-deployed systems would benefit from taking the time to understand and reflect on Python’s missteps.
Python 3.0 was released on December 3, 2008. And it took the better part of a decade for the community to embrace it. This should be universally recognized as a failure. While hindsight is 20/20, many of the issues with Python 3 were obvious at the time and could have been mitigated had the language maintainers been more accommodating - and dare I say empathetic - to its users.
The initial approach of Python 3 mirrors a folly that many developers and projects make: attempting a rewrite instead of performing incremental evolution.
Speaking of Rust, at the Mercurial developer meetup in October 2019, we were discussing the use of Rust in Mercurial and one of the core maintainers blurted out something along the lines of if Rust were at its current state 5 years ago, Mercurial would have likely ported from Python 2 to Rust instead of Python 3. As crazy as it initially sounded, I think I agree with that assessment…
Back to the topic of Python itself, I’m really soured on Python at this point in time. The effort required to port to Python 3 was staggering. For Mercurial, Python 3 introduces a ton of problems and doesn’t really solve many. We effectively sludged through mud for several years only to wind up in a state that feels strictly worse than where we started. I’m sure it will be strictly better in a few years. But at that point, we’re talking about a 5+ year transition. To call the Python 3 transition disruptive and distracting for the project would be an understatement. As a project maintainer, it’s natural to ask what we could have accomplished if we weren’t forced to carry out this sideshow.
But just go read the whole thing, slowly.
Personally, I would move my own code to Go instead of Rust. I like syntax that seems simple to me. This is mostly subjective, but I hire people to write Go code, and I watch those without prior Go experience uniformly need one day to become comfortable writing code in Go. That’s not anti-Rust; I’ve been saying for years that there are two interesting languages today, Go and Rust; I just happen to prefer Go for the kind of work I prefer to do, and have recommended Rust over Go for other projects where it would be naturally better.
Look, I know it is easy for me to armchair quarterback and critique with the benefit of hindsight/ignorance. I’m sure there is a lot of nuance here. I’m sure there was disagreement within the Python community over a lot of these issues. Maintaining a large and successful programming language and community like Python’s is hard and you aren’t going to please all the people all the time. And speaking as a maintainer, I have mad respect for the people leading such a large community. But niceties aside, everyone knows the Python 3 transition was rough and could have gone better. It should not have taken 11 years to get to where we are today.
A kind word at the end, but most of the problems he points out I remember explicitly being part of the discussion before Python 3 was finalized. This is a good summary of things that went wrong, but this was not news.