News for hackers. Stuff that matters.
Re:Python 3: Ten years later by mrweasel on Saturday December 22, 2018 @07:55AM (#18740376)
We where able to delete so much code when we switched to Python 3. When you integrate with especially Windows system converting unknown text was tricky at best.

It’s not that Python 2 couldn’t do it, but the corner cases and error handling was a pain. Trying to guess encoding at runtime was pretty error prone, with Python 3 it just works.

Python 3 was a rocky transision, but I never understood the negativity and I’ll be happy to see Python 2 die, so our system can go back to having just one Python interpretter.

Re:Python 3: Ten years later by the_mitsuhiko on Saturday December 22, 2018 @07:58AM (#18740388)
I think this is largely a second system result. If you want correct unicode handling it's not harder in 2.x than in 3.x. The main reason unicode support was more complex in 2.x for the most part is that many APIs supported working with Bytes and on 3.x that burden is pushed to the API consumer.

> Trying to guess encoding at runtime was pretty error prone, with Python 3 it just works.

You should not guess on 2.x either. On the other hand in 3.x the interpreter sometimes guesses the encoding for you when working with OS data on unix and that has lead to some absurd bugs when it falls into that surrogate handling fallback code: http://click.palletsprojects.com/en/7.x/python3/#python-3-su...

Re:Python 3: Ten years later by wbond on Saturday December 22, 2018 @03:20PM (#18742261)
At first blush you would think so, but I know for a fact that Unicode on Windows is not possible to properly handle below Python 3.4.

Python 3’s Unicode handling has been a huge win for cross-platform deployments in my experience. We run a patched version on 3.3 with some backports from 3.4 on millions of machines, and it is actually possible to support non-Latin filesystem paths, where that was just not possible when we were using 2.6.

In terms of an ecosystem, Python 3 forces casual developers to confront Unicode head on, where 2.x the default is to sweep it under the rug.

I’m extremely grateful that a breaking change was made, even if the execution wasn’t perfect.

Re:Python 3: Ten years later by the_mitsuhiko on Sunday December 23, 2018 @11:38AM (#18746971)
Click uses ctypes to retrofit some unicode support on 2.x for what it’s worth.
Re:Python 3: Ten years later by mrweasel on Saturday December 22, 2018 @08:46AM (#18740539)
>on 3.x that burden is pushed to the API consumer

So for most people it's better. The same goes for the guessing encoding part. Sure, you really shouldn't, but sometimes you had to and then you end up with chardet all over the place. Python 3 may do the exact same behind the scenes. The thing is that the Python core developer are much more talented than I am, so now I get to not think to much about it and just build on their work. From the "regular end-user developer" it's better.