Ask HN: Why all the hate for Python 3?

10 points by akulbe ↗ HN
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 ] thread
Because developers from cultures whose languages can be fully satisfied with the Latin-1 charset (which is the absolute majority in the developed world) don't get how important and essential Unicode is. But things are changing to better now, thankfully.
Python 2 had full Unicode support.
It was "full", but not "proper".
Yes, but not without effort the way it is in Python 3. Having to prefix strings with "u" and include the utf-8 encoding header sometimes are definitely nuisances in Python 2.
(comment deleted)
If you are a beginner, choosing Python 3 is a no brainer.

One 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.

What's more, choosing Python 3 was already a no-brainer for someone like me who was a Python beginner five years ago.

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...

>Guido has already said that Python 3 is the future of the language and development on Python 2 will come to an end.

That doesn't mean anything. Beyond a certain point a language is beyond the control of its original creator.

I even heard a joke: Python 2 = North Korea Python 3 = South Korea

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.

Don't worry about them, loud minority. Zed Shaw's book, (I've read it) does rub people the wrong way in many communities. Don't worry about it, mostly it got ad hominem over the years (think Phil Fish). Just focus on your studies and to hell with the rest.

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.

The only reason why I still use Python2.7.x instead of 3 is because I occasionally use old libraries/dependencies that have not yet been ported to python 3.x

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

In large part because python 3 just wasn't worth using for the first few (probably five or six) years. The big reason so many of us use python is because of the wide range of libraries and modules that no longer worked.

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.

Lots of library maintainers can't be arsed to put parentheses around their print statements (and perform the occasional slight change to other behaviors), or to run any of the automated tools that perform these compatibility-preserving changes. As a result, libraries maintained by these stubborn lazy people are not usable on python3, which makes beginners (who don't have a clear understanding of how these libraries are written and how easy it would be for them to perform the conversions themselves, because they still believe that "professionals" have some magic power other than the willingness to be persistent) wary of doing anything in python3.

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).

Full disclosure: I do not work in Python. However, I found your explanation really enlightening and it brings up a further question. If there are tools that would make these libraries better in some automated fashion, would there be an opportunity for an open source project to basically go through all of the libraries and check them for compatibility and then run the automation to try to upgrade them and submit pull requests for the outcome if it turned the project from incompatible to compatible?

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?

A properly written python2 module will already be python3 compatible, in most cases. Occasionally, modules that violate existing best practices will do so in ways that limit python3 compatibility. They can be fixed with automated tools that ship with python.

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.

> Lots of library maintainers can't be arsed to put parentheses around their print statements

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.

It's a slight overstatement for rhetorical purposes. Supporting python3 is not a difficult problem even for large libraries with single maintainers; as I noted, automatic translation tools exist.
It's not really an overstatement as much as completely incorrect and misleading.

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.

Airbnb hasn't been around for all that long. Why didn't they write their library with python3 support in the first place?

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.

As few others have said, Python3 still does not have full support for popular libraries from Python2. Yes, it is getting there but not yet. For example, according to this site [0], Carbon is not supported by Python3 yet.

[0] http://py3readiness.org/

Why do people like any language? In the case of Python it wasn't that the syntax was the best syntax ever and the way it did object oriented programming was the best. It was that it came with so much pre-existing functionality ("batteries included").

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.

UTF-8 never bothered me in Python 3. Most of the time you don't have to think about encoding. The times you have to pass through the network just ".encode()" the string and you're fine.

Seriously, can you show me a case where you did encounter problems with UTF-8 in 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.

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.