3 ms·
There is an explanation missing in that answer about how python 2 goofed up and python 3 strings fixed things. Without that explanation, showing how the Python
by wcoenen 14y ago
There is an explanation missing in that answer about how python 2 goofed up and python 3 strings fixed things. Without that explanation, showing how the Python 2 strings must be "decoded" is just terribly confusing.
It doesn't really make sense to "decode" a proper string type. Ideally the language should never reveal how it represents strings internally in memory, so you can think of strings as a sequence of abstract unicode codepoints with no specific encoding at all. And Python 3 strings are like that.
- hcarvalhoalves 14y agoPython 3's string type is simply Python 2's unicode. Python 3's bytes type is 2's string. Python 3 didn't fixed anything, they just cleared up the semantics because way too many people expect a type called "string" to hold "text" - but often what they really mean is "unicode".