On Wed, Oct 20, 2021 at 12:02 PM <2qdxy4rzwzuui...@potatochowder.com> wrote:
>
> On 2021-10-20 at 11:48:30 +1100,
> Chris Angelico <ros...@gmail.com> wrote:
>
> > TBH swapcase is a bit of a minefield if you don't know what language
> > you're working with.
>
> [...]
>
> > The most logical "negation" of a string would be reversing it, which
> > WOULD be... well, reversible. But that doesn't need an operator, since
> > it already has slice notation.
>
> Slice notation is also a minefield; [some] explosives are combining
> characters.

True, but since all of Python's indexing, slicing, etc, is defined by
codepoints, what that really means is that slicing/reversing a string
can cause peculiar behaviours. But that's true of many other types of
characters too; if you mix LTR and RTL text, with some directionless
text in between, you'll see some very peculiar behaviour when you
reverse it (try getting an English word, some ASCII digits, and an
Arabic word - the digits are the same ones that both languages use).
So I don't think combining characters are unique here.

"Reversing" text means many different things depending on context.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/VPFBG3M4FNB7QMRW3TO6M5JT4QT2PMYG/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to