Case-insensitive string equality

Pavol Lisy pavol.lisy at gmail.com
Sun Sep 3 15:58:47 EDT 2017


On 9/3/17, Steve D'Aprano <steve+python at pearwood.info> wrote:
> On Sun, 3 Sep 2017 05:17 pm, Stephan Houben wrote:
>
>> Generally speaking, the more you learn about case normalization,
>> the more attractive case sensitivity looks
>
> Just because something is hard doesn't mean its not worth doing.
>
> And just because you can't please all the people all the time doesn't mean
> its
> not worthwhile.

I was thinking about compare where false positivity is acceptable (and
well defined property).

For example if somebody has case sensitive FS and wants to publish
files and avoid name collision on any case insensitive FS then compare
with false positive equals could be useful.

Then backward compatibility problem could be (theoretically)
simplified to enhancing equivalence classes in future.

I mean something like ->

    equal = lambda a, b: any(f(a) == f(b) for f in C)    # where C is
enhanceble list of compare equals functions

Could you think that such equivalence relation could solve problems
which you describe in first mail in this thread?

And if trying to "solve" unicode problem why not? ->

    a ≐ b
    a ⋵ L



More information about the Python-list mailing list