The only problem with titles starting with “the only problem with” is that they by definition dismiss complaints without addressing them, thus coming across as ignorant and arrogant and doing nothing whatsoever to convince potential converts with its actual argument.
I can’t speak for all complainants, but my biggest problem with Python 3’s str is that it’s impossible to mechanically translate between it and Python 2’s str and unicode types, thus leading to a significant part of the idiotic, counterproductive and contentious 2/3 split. My biggest technical complaint is that Python 3 assumes it lives in a world where encoding is well-understood, well-signaled and consistently handled, i.e. a world which bears no resemblance to the one we actually live in.
One other thing:
Python 2 is dead, long live Python 3
Statements like this are a large part of why statements like this are so patently false. Stop treating your users like morons or a burden you’d rather not have (or you may soon not). Take their concerns seriously and address them. Anything claiming professionalism requires no less.
Similar experience, given some time to reflect on it. I never claimed to be a great python dev, but the outcome from converting some code was basically “you’re not a mediocre python dev; you’re actually a bad python dev.” This did not in fact inspire me to invest more time learning python3.
In my view, the problem with Python 3’s strings is that there are too many automatic conversions between bytes and strings, generally at the boundaries of IO. This creates a minefield of implicit locations where your programs can sometimes explode with Unicode encoding or decoding errors but they usually won’t, which of course makes it hard to find those locations (and you may not even realize that they’re there; for instance, is use of the syslog module an encoding boundary where you may see Unicode encoding errors?). Forcing all conversions to be explicit would surface all of those locations and make people explicitly consider both character encoding and error handling, but it would of course be much less transparent.
(This is also the problem with Python 2’s strings. It’s just that the conversions happened at different points in Python 2, namely when you had bytes and Unicode strings interact with each other, instead of at IO boundaries. The good thing you can say about Python 3’s string problems is that your Unicode errors will usually happen at the edges of your program, where it interacts with the outside world, instead of at random points inside, where bytes and Unicode strings got mixed together.)
Python 2’s shitty design has broken your mindset. Unlearn it.
I recently took a Python class at Cisco under the instruction of Wesley Chun. This is a guy who has been working with Python for several years and here he was teaching Python newbies about the version split. Per his recommendation, Python 2 should be avoided going forward. The only reason that seemed strong for keeping Python 2 around is for compatibility.
So, if you’re going to do anything in Python these days, avoid Python 2 and just stick with Python 3. If you really want to use something that is written in Python 2, avoid it.
Couldn’t agree more. It’s time to move on.
I understand the position regarding older codebases, but all new projects should use python3 from now on, there are very few valid excuses.