Re:Show HN: Shareable reasons to upgrade to Python 3
by mjevans on Thursday August 10, 2017 @06:55PM
(#14985129)
I actually argue that it's worse. In Python 3 you are FORCED to deal with unicode encoding; Python 3 does not react well with legacy data that should just be handled as is (without making things worse or incompatible).
The alternative is to use a byte array without an encoding, which would be OK if Python 3 made coercion between the two easy (and had the concept of a 'validated' unicode string; operations known to keep a unicode string valid could leave that set, otherwise it would be 'not validated' but you wouldn't /need/ to care).
Re:Show HN: Shareable reasons to upgrade to Python 3
by zzleeper on Thursday August 10, 2017 @07:04PM
(#14985176)
That prevents lots of mistakes. You only specify encodings while reading external data, and then everywhere else in your code you know you are dealing with strings and that's it (instead of your code working until a random Fóréígner trips it out)
Re:Show HN: Shareable reasons to upgrade to Python 3
by dbcurtis on Thursday August 10, 2017 @08:25PM
(#14985638)
Well, I spend most of my time dealing with internet and serial protocols, and the strict demarcation between unicode strings and byte strings is what keeps me sane. Explicit encode/decode calls are a feature, IMHO.
Unicode support is tremendously easier in Python 3. You don't have to deal with the confusing encode and decode stuff, and Python 3 strings have the right behavior in a lot of weird cases where Python 2.7 unicode objects do not.
Unicode support was my biggest reason for switching to Python 3, because I was dealing with natural language data with a lot of emojis and Python 2.7 was just an endless headache.