8 ms·
Breaking the Snake: How Python went from 2 to 3
- docandrew 4y agoHow much money and time was spent, collectively, updating projects, OS packages, and broken dependencies due to this transition? My guess is about $2B.
- meindnoch 4y ago“How Python went from 2 to 3” I know how: badly.
- TheRealPomax 4y agoMore "reluctantly" than "badly". Sure, millions of projects and bindings and people and tools all had to be convinced to transition independently, but they did. Kicking and screaming, and dragging their feet for as long as possible, but: they did. "Badly" would be if Python 3 had died after a prolonged death bed (I see you, Perl 6), but instead Python actually got there, in spite of all the haters. (initially justified haters, of course, but that just makes it all the more impressive that 3 wasn't abandoned before it got all the polish it needed before it could prove it was worth the effort)
- wiz21c 4y agoI'd say that the biggest change for me was migrating string to unicode. But since I usually work outside ASCII, migrating to Unicode has made python much saner to me...
- Jasper_ 4y agoThere were a lot of people that left Python for other languages and never came back in the whole 2 to 3 debacle. It doesn't help that the early versions of Python 3 were really opinionated and terrible. Python 3 only took off after they walked back a lot of the strong opinions that made them do a language break in the first place. Knowing what is known now about the transition, Python 2.8 would have been a much smarter idea.
- kelipso 4y agoYeah I avoid python for any project I have control over.
- saghm 4y ago> It doesn't help that the early versions of Python 3 were really opinionated and terrible Isn't opinionated kind of Python's thing? I can understand "terrible" being bad, but like, "terrible and unopinionated" sounds bad as well. As someone who never really bought into "there should be only one way to do it", it's kind of hard not to be amused at the thought of the Python community suddenly realizing that maybe being too opinionated can sometimes be a bad thing.
- pantalaimon 4y agoAren’t there at least three ways to format strings these days?
- saghm 4y agoI never claimed that they were good at following this philosophy, just that they espoused it. Maybe they've let up because being opinionated stopped working.
- TheRealPomax 4y agoAbsolutely, but it's not a static pool. A lot of new folks happily use 3.10 today that would have looked at 2.7 and gone "what century is this? No thanks", so even if on an individual level Python 3 might feel like it failed you, as a programming language it succeeded in changing with the times and staying not just relevant, but actually popular.
- orev 4y agoAll future generations should remember the Python 2 to 3 transition as the one time in history that a programming language successfully made a breaking change so far into maturity and survived, and only just by one single fingertip holding on to avoid falling into the abyss below. (I’m being hyperbolic, a little).
- Kukumber 4y agoThat's exactly this Courageous transition! A language that doesn't evolve and is scared of change is a dead language That's true for programming languages, but also for spoken languages too I hope the D community gets it right when they design the version 3 of their language A lot to learn from Python's successful transition
- chucke 4y agoTell that to perl, or php.
- Kukumber 4y agoTell that to python, or C#
- chucke 4y agoWhat example is C# exactly? Never struck me as anything reaching wide adoption outside of the enterprise MS market, and you can certainly change anything if your customers already sunk the licensing cost. I certainly never and will never touch it, with or without incompatible language changes.
- Kukumber 4y ago.net -> dotnet core
- flohofwoe 4y agoI really can't say if you're serious or joking. Python's transition can only be called 'successful' if the plan was to inflict as much pain as possible on maintainers of Python projects (and nowadays, Typescript via Deno doesn't really look all that bad for new projects where I would have used Python before). If the 2-to-3 transition hadn't left so many scars, the idea to switch to a different language for cross-platform command line tools wouldn't even enter my mind. Python 2.x was just perfect for this use case, and Python3 didn't add anything of value for such scripts.
- Scubabear68 4y agoI wonder if changing the name might have made a difference, “announcing Cobra, the successor to Python 2!”. Or something. Obviously this didn’t go well for Perl, but Perl did the rename ridiculously too late.
- mongol 4y agoNext time something like this happens, something like Chat GPT will make it much more seamless. "Chat GPT, please rewrite this program to be Python 4 compatible"
- dmarchand90 4y agoI really doubt it. Or rather, I think thy level of intelligence needed would be so high that chatgpt would be doing all the coding for everything.
- mongol 4y agoI don't see why Chat GPT would fail at changing print statements to print() method invocations.
- samwillis 4y agoYou say that, but the 2to3 tool did a brilliant job of doing just that, and as it understood the AST it actually didn't try to bullshit like ChatGPT and Co-Pilot do at time. I use Co-Pilot, it's super helpful but, god it's good at bullshitting. Sometimes you think "wow" but then stop and look what it's done and it's all very wrong, but looks very right. Although that's only like 10% of the time. Im looking forward till they combine Co-Pilot with the static analysis tools you have with statically typed languages, that is going to be so much better.
- chx 4y agoyou people have completely lost it i am shocked to see this level of PHBS (pointed head boss syndrome) in this space. Aren't you people supposed to be technical and whatnot? It's a Stochastic Parrot (https://dl.acm.org/doi/10.1145/3442188.3445922 https://dl.acm.org/doi/10.1145/3442188.3445922) and as such , it can't be trusted with software (nor with anything else bug I digress).
- turtleyacht 4y agoIs it a stronger argument if there is a proof establishing an upper bounds of "pathological derangement" with regard to large language model AI? Wonder if that would lead to regulations around language model "strength tiers," and whether certain industries will even allow Copilot or ChatGPT-like code.
- axpy906 4y agoIt’s interesting how the article reads linearly but the change for my code as was not. My new projects went to 3.5 and my existing codebse got maintained at 2.7 until a version update opportunity arose. It took a few years to get everything over.
- AlbertCory 4y agoHow it went: badly. No matter what anyone says about how it finally succeeded: taking a decade is just plain disastrous. Saying "a language has to evolve" is vapid and meaningless. "Change" per se is not good OR bad in itself. To start with, 3 fixed a lot of things that were not really broken. As Jasper_ says below, "Python 2.8 would have been a much smarter idea."
- azinman2 4y agoMy hope for python 4: find a way to accept both styles of something (eg `print foo` and ‘ `print(foo)`), with deprecation warnings. Deprecation warnings would be something new in Python as it’s not “compiled”, but if a way was figured out then you could eventually yank the old behavior after a date far into the future.
- maxnoe 4y agoPython absolutely already has deprecation warnings, that would be nothing new
- nickdrozd 4y agoIt took bold and determined leadership to make the breaking changes necessary to do things the right way. There were plenty of entrenched interests that would have preferred to keep doing things the wrong way because it was easier in the short term. If GvR and the rest of the core developers had been cowed by the reactionaries, Python would have stagnated. Instead, they persevered, and the language is much, much better today because of it. Woe to those of us who still have to use Python 2.
- bin_bash 4y agoRyan Dahl's great talk on design mistakes he made with node.js is something I think about all the time: https://www.youtube.com/watch?v=M3BM9TB-8yA https://www.youtube.com/watch?v=M3BM9TB-8yA Even though he considers things like `require('./something')` defaulting to either `./something.js` or `./something/index.js` a mistake, he also admits these are not possible to change at this point. I think Python made a mistake trying to correct design problems in 2. The cost of change simply wasn't worth the price of migration. Is `print("text")` really that much of an improvement over `print "text"`?
- vore 4y agoPython 2 string handling was really quite a mess compared to Python 3, and fixing it would have required manual intervention in any case (since it wasn't possible to distinguish usage of strings in Python 2 from raw byte sequences in a lot of cases). I think the print statement to function part of it was a way way more minor pain point compared to the str/unicode change, and is a fully automatable transformation anyway.
- julienfr112 4y agoIf python3 just brought print(), it would not have been worth it. But bytes and string, totally worth it. I never once had problem with encoding in python3.
- IshKebab 4y agoThey did manage to mess up the encoding of `open()` in Python 3 though... So I bet at least some people have problems.
- gumby 4y agoWhenever I hear about some useful proposal for C++ being shot down because “this would be a breaking change” I gnash my teeth in frustration, but then remember the python 3 debacle and calm down. In fact a lot of my frustration with C++ evolution is due to the committee’s experience of having made a couple of bad decisions that had to be undone (like auto_ptr), or which are unrepairsble (overconstrained unordered_map). Which is a great example of why you shouldn’t have someone like me on the committee!
- pjmlp 4y agoThink of Java 8 => 9 and .NET Framework => Core as two other examples of what happens when breaking backwards compatibility.
- naet 4y agoThe Python 2-3 transition was terrible and may have changed the course of my career. I was just getting into programming and thought Python would be a good place to start, but ended up being put off by the schism between the two versions. It seemed like everything I looked at was filled with caveats about not being compatible with one version or the other. I thought 3 sounded like the better choice since it was newer, but so many learning resources were stuck on 2 with no plans to upgrade, but I didn't want to be stuck on an old version, and I didn't have enough experience to make an informed decision.... So I eventually ended up dropping Python entirely. Maybe now is a good time for me to revisit Python if that isn't an issue anymore.
- revskill 4y agoNeed something like Babel for Python and problem solved ?
- mikebenfield 4y agoHere's one of the things that honestly surprised me about the Python 2 -> 3 debacle. I witnessed people in 2020 starting new Python projects and deliberately choosing Python 2. For no real reason. They were fully aware that Python 3 existed, but they just sort of arbitrarily chose to use Python 2. This was about 12 years after Python 3 was originally released, it was after Python 2 was sunset, and none of the dependencies of these projects required Python 2. It honestly makes me feel a little nihilistic about versioning and upgrades. I know there were many legitimate technical challenges for many people in moving from Python 2 to 3. But I now feel that versioning is always going to be bumpy, regardless of the technical issues, because a substantial number of users will make strange decisions.
- hulitu 4y agoIf builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
- chucksmash 4y agoIt was not for no reason. It's that people knew Python 2, whereas for many what they knew about Python 3 was: - I heard it is a lot of work to switch over (must be pretty different!). - Learning more about it is on my todo list, but I haven't had a chance to get around to it yet. That's not to excuse their decisionmaking from a do-the-right-thing standpoint, because they weren't doing right by their clients, but I feel it's totally understandable. I remember speaking to conscientious engineers a few years before that who only knew a smattering of Python from the 2.7 era and were apprenhensive about starting a new project in 3.x. Sometimes you just have to hold people's hands a little. Maybe not a "good" reason, but so it goes.