2 ms·
Why is it ambiguous? The Python documentation is pretty clear about what type of elements a string contains: > Strings are immutable sequences of Unicode code
by tremon 3y ago
Why is it ambiguous? The Python documentation is pretty clear about what type of elements a string contains:
> Strings are immutable sequences of Unicode code points
(from https://docs.python.org/3/library/stdtypes.html#text-sequence-type-str https://docs.python.org/3/library/stdtypes.html#text-sequenc...)
- ThunderSizzle 3y agoAccording to python. Every language can have a different definition. C#, for example, defines the blocks to be Char objects, which is based on UTF 16: > The Length property of a string represents the number of Char objects it contains, not the number of Unicode characters. https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/strings/ https://learn.microsoft.com/en-us/dotnet/csharp/programming-...
- WorldMaker 3y agoThough C# also recommends the Rune APIs for more modern/better code point handling. The Rune APIs have a bit more in common with Python 3's unicode treatment than the classic (and sometimes wrong) UTF-16 approach. https://learn.microsoft.com/en-us/dotnet/api/system.text.rune?view=net-7.0 https://learn.microsoft.com/en-us/dotnet/api/system.text.run...
- amake 3y agoDid you not read the article?