⬅︎ Back to Case insensitive list remove call
The following (based on a guess about how list.remove() might work) is perhaps a nicer solution:class CaseInsensitiveString(object):... def __init__(self, s):....... self.s = s... def __cmp__(self, other):....... return cmp(self.s.lower(), other.lower())L = list('ABC')L.remove(CaseInsensitiveString("c"))
Comment
The following (based on a guess about how list.remove() might work) is perhaps a nicer solution:
class CaseInsensitiveString(object):
... def __init__(self, s):
....... self.s = s
... def __cmp__(self, other):
....... return cmp(self.s.lower(), other.lower())
L = list('ABC')
L.remove(CaseInsensitiveString("c"))