Re:Mercurial’s journey to and reflections on Python 3
by cbsmith on Monday January 13, 2020 @08:02PM
(#22040696)
Everything isn't bytes. Strings without an encoding don't have a specific byte representation.
[ Parent
| on HN ]
Re:Mercurial’s journey to and reflections on Python 3
by takeda on Tuesday January 14, 2020 @12:48AM
(#22042204)
It's the other way around. Strings always have meanings and always reference the same characters. You use encoding to encode strings into bytes.
Bytes without encoding, don't have any meaning, they are just... random bytes.
Re:Mercurial’s journey to and reflections on Python 3
by cbsmith on Wednesday January 15, 2020 @04:22PM
(#22058772)
We're actually saying the same thing. You're saying without an encoding you can't turn bytes into a string (technically, in Python terminology, that's a decoding, but you know... ;-). I'm saying a string doesn't have a byte representation without an encoding. That's two perspectives on the same truth.
I absolutely agree that a string has meaning without a byte representation. That's the whole point of having it as a distinct type.