News for hackers. Stuff that matters.
Re:It’s Not Wrong that “ ”.length == 7 by amake on Friday June 02, 2023 @04:26AM (#36162615)
It's ambiguous because it's not clear what elements go into separate cells of the array.
Re:It’s Not Wrong that “ ”.length == 7 by tremon on Friday June 02, 2023 @05:04AM (#36162877)
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-sequenc...)

Re:It’s Not Wrong that “ ”.length == 7 by ThunderSizzle on Friday June 02, 2023 @06:28AM (#36163375)
According 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-...

Re:It’s Not Wrong that “ ”.length == 7 by WorldMaker on Friday June 02, 2023 @01:00PM (#36167726)
Though 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.run...

Re:It’s Not Wrong that “ ”.length == 7 by amake on Friday June 02, 2023 @08:59AM (#36164473)
Did you not read the article?