Python 2 had one mostly-working str
class, and a mostly-broken unicode
class.
Python 3, for some reason, got rid of the one that mostly worked, leaving no replacement. The closest you can get is to spam surrogateescape
everywhere, which is both incorrect and has significant performance cost - and that still leaves several APIs unavailable.
Simply removing str
indexing would’ve fixed the common user mistake if that was really desirable. It’s not like unicode
indexing is meaningful either, and now large amounts of historical data can no longer be accessed from Python.
It’s because
unicode
was really broken, and a lot of the obvious breakage was when people mixed the two. So they did fix some of the obvious breakage, but they left a lot of the subtle breakage (in addition to breaking a lot of existing correct code, and introducing a completely nonsensicalbytes
class).