in pinax Userdict.py:
def __getitem__(self, key):
if key in self.data:
return self.data[key]
if hasattr(self.__class__, "__missing__"):
return self.__class__.__missing__(self, key)
why does it do this on self.__class__.__missing__.
thanks
The UserDict.py presented here emulates built-in
dictclosely, so for example:just as you can override the special method
__missing__to deal with missing keys when you subclass the built-indict, so can you override it when you subclass thatUserDict.The official Python docs for dict are here, and they do say: