Enjoying Inheritance and operator Overloading

Fuzzyman michael at foord.net
Mon Mar 15 11:44:28 EST 2004


> 
>     def __delitem__(self, item):                # deleting a keyword
>         key = item.lower()
>         if not self.has_key(key):
>             raise KeyError(item)
>         dict.__delitem__(key)
> 
Oops - except dict.__delitem__ ought have both self and item as arguments....

Regards,


Fuzzy

http://www.voidspace.org.uk/atlantibots/pythonutils.html


> 
> if __name__ == '__main__':
>     a = lowerDict()
>     a['HELLO'] =3
>     print a



More information about the Python-list mailing list