TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Breaking the Snake: How Python went from 2 to 3

29 点作者 Decabytes超过 2 年前

15 条评论

AlbertCory超过 2 年前
How it went: badly.<p>No matter what anyone says about how it finally succeeded: taking a decade is just plain disastrous. Saying &quot;a language has to evolve&quot; is vapid and meaningless. &quot;Change&quot; per se is not good OR bad in itself.<p>To start with, 3 fixed a lot of things that were not <i>really</i> broken. As Jasper_ says below, &quot;Python 2.8 would have been a much smarter idea.&quot;
orev超过 2 年前
All 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.<p>(I’m being hyperbolic, a little).
评论 #34469006 未加载
评论 #34468126 未加载
评论 #34468127 未加载
评论 #34469148 未加载
评论 #34468327 未加载
julienfr112超过 2 年前
If 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.
评论 #34471933 未加载
naet超过 2 年前
The Python 2-3 transition was terrible and may have changed the course of my career.<p>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&#x27;t want to be stuck on an old version, and I didn&#x27;t have enough experience to make an informed decision.... So I eventually ended up dropping Python entirely.<p>Maybe now is a good time for me to revisit Python if that isn&#x27;t an issue anymore.
bin_bash超过 2 年前
Ryan Dahl&#x27;s great talk on design mistakes he made with node.js is something I think about all the time: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=M3BM9TB-8yA">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=M3BM9TB-8yA</a><p>Even though he considers things like `require(&#x27;.&#x2F;something&#x27;)` defaulting to either `.&#x2F;something.js` or `.&#x2F;something&#x2F;index.js` a mistake, he also admits these are not possible to change at this point.<p>I think Python made a mistake trying to correct design problems in 2. The cost of change simply wasn&#x27;t worth the price of migration. Is `print(&quot;text&quot;)` really that much of an improvement over `print &quot;text&quot;`?
评论 #34468876 未加载
axpy906超过 2 年前
It’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.
mongol超过 2 年前
Next time something like this happens, something like Chat GPT will make it much more seamless. &quot;Chat GPT, please rewrite this program to be Python 4 compatible&quot;
评论 #34468582 未加载
评论 #34468749 未加载
评论 #34469208 未加载
mikebenfield超过 2 年前
Here&#x27;s one of the things that honestly surprised me about the Python 2 -&gt; 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.<p>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.
评论 #34470053 未加载
评论 #34469374 未加载
gumby超过 2 年前
Whenever 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.<p>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!
评论 #34469232 未加载
azinman2超过 2 年前
My 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.
评论 #34468680 未加载
Scubabear68超过 2 年前
I wonder if changing the name might have made a difference, “announcing Cobra, the successor to Python 2!”. Or something.<p>Obviously this didn’t go well for Perl, but Perl did the rename ridiculously too late.
docandrew超过 2 年前
How much money and time was spent, collectively, updating projects, OS packages, and broken dependencies due to this transition? My guess is about $2B.
评论 #34468740 未加载
评论 #34468514 未加载
nickdrozd超过 2 年前
It 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.
meindnoch超过 2 年前
“How Python went from 2 to 3”<p>I know how: badly.
评论 #34468143 未加载
revskill超过 2 年前
Need something like Babel for Python and problem solved ?