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