Ask HN: Why all the hate for Python 3?
Zed Shaw makes a case against Python 3 in his LPTHW, now. Personally, it rubs me the wrong way.
Another guy speaks and makes a rebuttal (https://eev.ee/blog/2016/11/23/a-rebuttal-for-python-3/)
Guido has already said that Python 3 is the future of the language and development on Python 2 will come to an end.
Why does this seem to be so hard to accept? Why all the hate for 3.x?
I don't have a dog in the fight, but as a newcomer to the language, it's a bit unnerving.
24 comments
[ 5.7 ms ] story [ 69.8 ms ] threadOne of the main reasons for all the hate towards Python 3 is because it is not backwards compatible with Python 2. So people who have a lot invested in Python 2 have to port the codebase to Python 3. Another issue is that some libraries have not been ported to Python 3. This is becoming less of an issue as all the major libraries have been ported to Python 3.
Anything Zed Shaw says (or anyone for that matter), cross check the facts before drawing conclusions.
Don't worry... eventually we'll get Python 4 or something, and then all of us who learned Python 3 first will become the grumbling holdouts...
That doesn't mean anything. Beyond a certain point a language is beyond the control of its original creator.
Except Swift 2 to Swift 3 has a good start, breaking as much source compatibility as they could is a great choice when the language is still young.
PHP 5.6 adopted UTF8 by default for security and Python 2 is mature and solve many problems in the past, I would say most programmers are lazy writing test suite as well.
You should start with Python 3 or Swift 3, both are a fine language for the modern world.
People arguing about other's technical choices in computing are just children grown to size L anyway. What do you care what others go their work with? There Is No One Good Way.
Python 2.7 is about to "Expire" though, https://pythonclock.org/
But as a newcomer, it depends on what you are doing, if your tooling is already python 3.x compatible, then I see no reason to stick with 2.7x
And when selling it to people, it was usually "Oh, just do X, Y, and Z and you can port this library to Python 3". Not to mention all of the "Just write your python scripts to be backwards compatible".
So, as a user, I saw no reason to push it. A lot of hassle to not even really take advantage of anything to stay backwards compatible. And the moment we found a library that wasn't ported, we were back to 2.x.
Not to mention the zealots who would then explain to me how I was horribly wrong and that my firm is wrong and that we are bad people and blah blah blah blah blah.
These days it is a much easier sell in terms of compatibility as most (not all) major libraries have migrated. My personal work tends to be in python 3 and we try to make our in-house tools work for both (but 2.x is the priority). But most of our users are still going to use 2.x simply because there is no compelling reason to migrate (even if the migration is "Put parentheses after 'print'").
And the zealots are still annoying as hell.
And if 2.x really stops getting supported? I hope we'll migrate to 3, but there will be a lot of research and soul-searching first. Because now there are other languages with similar capabilities and if we are going to have to teach everyone something new, we might as well do it right.
It's very straightforward to write code that works in python 2 and python 3, and anyone learning python for the first time should be learning to write in that way. Ultimately, many of the compatibility changes are making things that have long been possible but considered poor style / bad habits no longer possible when doing so made the language easier to understand and behaviors more predictable (think print statement vs print function), or streamlining things that were originally bolted-on (think unicode).
I live over in the Ruby and JavaScript realm of things. I can imagine running through every project on Ruby Gems or on NPM and through it would be a monstrous undertaking it would be useful to the community and to the projects themselves. Would this be possible on the Python side of things as well?
Package systems like pip have separate repositories for python2 and python3, and you can have both python2 and python3 installed along with pip3 and pip2, and a whole package set for each; a package that is not compatible with python3 won't be available from pip3. But, most packages were already compatible, and those that weren't have had many years to become compatible.
Any python package that currently doesn't support python3 is either no longer being maintained or is acting as a political statement.
Sorry, but this comment is really misinformed. Most libraries do not exactly have tons of print statements. Library compatibility across 2/3 has more to do with the changes to strings.
Yes, 2to3, tox, etc exist, but of course in practice it's not necessarily that simple, even for bigger libraries. Take Airbnb's Airflow for example.
Yes, there are some python2 features that work differently in python3. But python3 has existed for a decade now, and there aren't real benefits to using forward-incompatible methods. Writing code that won't work in both is a mistake.
[0] http://py3readiness.org/
Anyway, Zed Shaw is, in my opinion, worth paying attention to. This essay seems particularly relevant to the current kertuffle: https://web.archive.org/web/20120821234313/http://learncodet...
So now there is an improved version called Python 3. OK, now we get into a discussion of why it is improved. That causes the always divisive discussion of how people should be programming.
IMHO the biggest problem with Python 3 is the Unicode stuff. The world seems to be moving toward just using UTF-8 for everything. The approach taken by Python 3 seems pointlessly complex and inefficient at this point in time.
Seriously, can you show me a case where you did encounter problems with UTF-8 in Python 3? :)
Eventually Python 2 will come to end. He issued this statement in the past and it didn't happen on the timeline he had hoped. At PyCon this year an extended life for Python 2 was announced, until 2020 IIRC.