Python Software Foundation survey finds that a significant number of Python developers are still using Python 2 for data analysis, computer graphics, and devops.
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 nonsensical bytes class).
Python 2 had one mostly-working
strclass, and a mostly-brokenunicodeclass.Python 3, for some reason, got rid of the one that mostly worked, leaving no replacement. The closest you can get is to spam
surrogateescapeeverywhere, which is both incorrect and has significant performance cost - and that still leaves several APIs unavailable.Simply removing
strindexing would’ve fixed the common user mistake if that was really desirable. It’s not likeunicodeindexing is meaningful either, and now large amounts of historical data can no longer be accessed from Python.Thanks for that context. Seems odd that they would remove the
strinstead of taking the time to fix it.It’s because
unicodewas 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 nonsensicalbytesclass).