On Sat, Sep 2, 2017 at 12:21 PM, Steve D'Aprano <steve+pyt...@pearwood.info> wrote: > On Fri, 1 Sep 2017 01:29 am, Tim Chase wrote: > >> On 2017-08-31 07:10, Steven D'Aprano wrote: >>> So I'd like to propose some additions to 3.7 or 3.8. >> >> Adding my "yes, a case-insensitive equality-check would be useful" >> with the following concerns: >> >> I'd want to have an optional parameter to take locale into >> consideration. E.g. > > Does regular case-sensitive equality take the locale into consideration? > > How do I convince Python to return true for these? > > 'i'.upper() == 'İ' > 'I'.lower() == 'ı' > > > I'm 99% sure that these are rhetorical questions where the answers are > obviously: > > - No it doesn't. > - And you can't. > > If regular case-sensitive string comparisons don't support the locale, why > should case-insensitive comparisons be required to? > > We should not confuse "nice to have" for "must have". As far as I'm concerned, > the only "must have" is that ASCII letters do the right thing. Everything > beyond that is a "quality of implementation" issue.
The only "must have" is that the locale-independent conversions do the right thing. We already have str.casefold() that correctly handles >99% of situations; the easiest way to craft something like this is to define it in terms of that. > In any case, thanks to everyone for their feedback. Clearly there not enough > support for this for me to even bother taking it to Python-Ideas. Agreed; if this were important enough for someone to want to run the gauntlet of -ideas and -dev, I'd predict that it would be one of those VERY hotly debated topics. ChrisA On Sat, Sep 2, 2017 at 12:21 PM, Steve D'Aprano <steve+pyt...@pearwood.info> wrote: > On Fri, 1 Sep 2017 01:29 am, Tim Chase wrote: > >> On 2017-08-31 07:10, Steven D'Aprano wrote: >>> So I'd like to propose some additions to 3.7 or 3.8. >> >> Adding my "yes, a case-insensitive equality-check would be useful" >> with the following concerns: >> >> I'd want to have an optional parameter to take locale into >> consideration. E.g. > > Does regular case-sensitive equality take the locale into consideration? > > How do I convince Python to return true for these? > > 'i'.upper() == 'İ' > 'I'.lower() == 'ı' > > > I'm 99% sure that these are rhetorical questions where the answers are > obviously: > > - No it doesn't. > - And you can't. > > If regular case-sensitive string comparisons don't support the locale, why > should case-insensitive comparisons be required to? > > We should not confuse "nice to have" for "must have". As far as I'm concerned, > the only "must have" is that ASCII letters do the right thing. Everything > beyond that is a "quality of implementation" issue. > > > In any case, thanks to everyone for their feedback. Clearly there not enough > support for this for me to even bother taking it to Python-Ideas. > > > > > -- > Steve > “Cheer up,” they said, “things could be worse.” So I cheered up, and sure > enough, things got worse. > > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list