Live data from Hacker News

Strings – Dive Into Python 3

getpython3.com

31–32 of 32 posts

Re: Strings – Dive Into Python 3

#31
post #29
post #25

A Friday challenge: In Python when is u'ß'.upper() equal to u'SS'? I discovered one case today, there may be others. Answer: https://twitter.com/moreati/status/332910618858364928

Actually, this is a bug. Unicode codepoint U+1E9E is LATIN CAPITAL LETTER SHARP S and should be the result of u"ß".upper(). This is especially so because otherwise u"Maße".upper() (Maße means measures) returns "MASSE", which could be confused with u"Masse".upper() (Masse means mass). In such cases, where confusion is possible and no uppercase ß is available, the German dictionary Duden actually suggests using SZ inst…

According to Unicode ß gets converted to SS in uppercase. This is by definition and doesn't change (stability policies, as far as I recall). Even in German you'll never see ß capitalised as SZ (except when I do it, but I'm a very, very small minority – and now I'm more likely to use ẞ).

Re: Strings – Dive Into Python 3

#32
post #2

Apparently, all I know about strings is correct.

And, he didn't even touch on the horror that is EBCDIC. Once you've had to touch that, the idea of "code point" for a character is something you can't ignore, hoping that things just work "most of the time" -- ASCII A != EBCDIC A.

EBCDIC A != EBCDIC A :-)

It's easier to read text on punchcards in EBCDIC of whatever variation, though.

Post reply on HN