Sadly this is right. Many people see python 2 as the end of the line and python 3 as a different language. The port from python 2 to 3 cannot be automated (who are you kidding!) you must really understand the details of the code to port it without mistakes. This is too expensive. If people must understand code to port it they may as well consider porting it to other languages. Breaking backward compatibility is ok when it does not result in change of behavior. print->print() is fine, except to except/as is pointless but tolerable, but swapping str/unicode for bytes/str is diabolic.
... and from my experience, most projects having a hard time porting because of unicode issues is because they have been careless. There are exceptions of course. If I recall correctly, mitsuhiko had a couple of very valid points regarding flask. But that's a corner-case.
In Python 2 you could read from a network socked and just assume it was ascii. Python 2 did not force you to make the necessary research. Now, with Python 3 you are forced to de/encode data on the appropriate boundaries. This is a very good thing! And making it clear that you get bytes from a network socket and not a string is a very important distinction! Reading from such a source and encoding the result is playing with fire... Yet Python 2 allowed it.
Yes, Python 3 has made this more verbose and more of a chore than it was previously (and I reckon that is why people are complaining). But it forces you to at least think about encodings where necessary and may avoid nasty bugs.
4
u/mdipierro May 26 '14
Sadly this is right. Many people see python 2 as the end of the line and python 3 as a different language. The port from python 2 to 3 cannot be automated (who are you kidding!) you must really understand the details of the code to port it without mistakes. This is too expensive. If people must understand code to port it they may as well consider porting it to other languages. Breaking backward compatibility is ok when it does not result in change of behavior. print->print() is fine, except to except/as is pointless but tolerable, but swapping str/unicode for bytes/str is diabolic.