Case-insensitive string compare?

Robert Dailey rcdailey at gmail.com
Fri Sep 5 16:22:13 EDT 2008


On Fri, Sep 5, 2008 at 12:36 PM, Fredrik Lundh <fredrik at pythonware.com>wrote:

> Maric Michaud wrote:
>
>  I suspect you are coming to conclusions a bit quickly, without taking the
>> pain of understanding the whole discussion.
>>
>
> I'm pretty sure I was the first one to post an answer in this thread, and I
> understand Python design and performance issues very well, thank you.
>
> (but given your talk about "the cost of whitespace" in a response to a
> comment about performance in that other subthread, it's obvious that you're
> just here to provide noise.  plonk plonk.)


Thanks to the helpfulness of the python community, I've made a decision on
how I wish to solve this problem. I decided to go ahead and pre-format my
dictionary's keys to lowercase, and leave the values untouched
(Case-retained). This way, any comparisons I perform will always be on
lowercase (case insensitive) keys. All I have to do is call lower() on the
value I'll be comparing against the keys.

Thanks to everyone that helped. Apologies for the flame war that started!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080905/77a8e8ef/attachment-0001.html>


More information about the Python-list mailing list