On Sat, Sep 2, 2017 at 10:09 AM, Steve D'Aprano
<steve+pyt...@pearwood.info> wrote:
> The question wasn't what "\N{LATIN SMALL LIGATURE FI}".upper() would find,
> but "\N{LATIN SMALL LIGATURE FI}".
>
> Nor did they ask about
>
> "\N{LATIN SMALL LIGATURE FI}".replace("\N{LATIN SMALL LIGATURE
> FI}", "Surprise!")
>
>> So what's the definition of "case insensitive find"? The most simple
>> and obvious form is:
>>
>> def case_insensitive_find(self, other):
>>     return self.casefold().find(other.casefold())
>
> That's not the definition, that's an implementation.

It's a reference implementation that defines certain semantics.
Obviously you can *actually* implement it using some kind of C-level
loop or something, as long as you can define the semantics somehow.

So what IS your definition of "case insensitive find"? Do you
case-fold both strings or just one? What do you do about
length-changing case folding?

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to