Share Code Tips
Devyn Collier Johnson
devyncjohnson at gmail.com
Sat Jul 20 06:06:07 EDT 2013
On 07/19/2013 09:51 PM, Dave Angel wrote:
> On 07/19/2013 09:04 PM, Devyn Collier Johnson wrote:
>>
>
> <snip>
>>>
>> Chris Angelico said that casefold is not perfect. In the future, I want
>> to make the perfect international-case-insensitive if-statement. For
>> now, my code only supports a limited range of characters. Even with
>> casefold, I will have some issues as Chris Angelico mentioned. Also, "ß"
>> is not really the same as "ss".
>>
>
> Sure, the casefold() method has its problems. But you're going to
> avoid using it till you can do a "perfect" one?
>
> Perfect in what context? For "case sensitively" comparing people's
> names in a single language in a single country? Perhaps that can be
> made perfect. For certain combinations of language and country.
>
> But if you want to compare words in an unspecified language with an
> unspecified country, it cannot be done.
>
> If you've got a particular goal in mind, great. But as a library
> function, you're better off using the best standard method available,
> and document what its limitations are. One way of documenting such is
> to quote the appropriate standards, with their caveats.
>
>
> By the way, you mentioned earlier that you're restricting yourself to
> Latin characters. The lower() method is inadequate for many of those
> as well. Perhaps you meant ASCII instead.
>
Of course not, Dave; I will implement casefold. I just plan to not stop
there. My program should not come across unspecified languages. Yeah, I
meant ASCII, but I was unaware that lower() had some limitation on Latin
letters.
Mahalo,
DCJ
More information about the Python-list
mailing list