6 ms·
For what reason other than perhaps font rendering code do you need to index code points in a string? Everything you think you need code points for (character c
by Avernar 11y ago
For what reason other than perhaps font rendering code do you need to index code points in a string? Everything you think you need code points for (character counting, truncation, etc) you actually need grapheme clusters.
I wish Python went with UTF-8 instead of their multi width internal representation.
- Veedrac 11y agoThe problem IMHO is more not regressing on lots of already-written code which assumes O(1) indexing, and less a problem of principle.
- Avernar 11y agoMost code works perfectly fine indexing bytes in a UTF-8 string. Anything that looks for stuff in the ASCII range such as parsers would not need to be changed. Python 3 already required all code to be looked over because of the string literal change so it wouldn't be much different.