3 ms·
>Should this throw an error because there's only one displayed "character"? Absolutely.
by coldtea 3y ago
>Should this throw an error because there's only one displayed "character"?
Absolutely.
- BeefWellington 3y agoI think this is where the misunderstanding comes in. Python doesn't treat strings as char[] but as essentially unicode_codepoint[]. Whether this is a good idea on the whole is debatable, there's even a full PEP talking about the security concerns around doing it this way[1]. However, given this is how it works, the behaviour displayed makes complete sense to me and is the best of the bad choices presented by needing multi-byte strings. [1]: https://peps.python.org/pep-0672/ https://peps.python.org/pep-0672/