On Wed, 12 Sep 2007 09:51:02 +0200, stef wrote:
> If you're going to extend the dictionary, there's one other flag I'm
> continuously missing: "case-insensitive" key.
Completely untested and probably buggy as anything, but here's an
absolutely minimal case-insensitive dictionary.
class CaselessDict(dict):
def __setitem__(self, key, value):
super(CaselessDict, self).__setitem__(key.lower(), value)
def __getitem__(self, key):
return super(CaselessDict, self).__getitem__(key.lower())
--
Steven.
--
http://mail.python.org/mailman/listinfo/python-list