2 ms·
> The correct cross-platform solution is to do It's absolutely not correct, because there are many APIs which take "native strings" across versions aka they ta
by masklinn 8y ago
> The correct cross-platform solution is to do
It's absolutely not correct, because there are many APIs which take "native strings" across versions aka they take an `str` (byte string) in Python 2 and an `str` (unicode string) in Python 3. unicode_literals causes significantly more problems than they solve.
The correct cross-platform solution (and the very reason why the `u` prefix was reintroduced after having initially been removed from Python 3) is in fact to use b"" for known byte strings, u"" for known text, and "" for "native strings" to interact with APIs which specifically need that.