Thursday, October 26, 2006
Sunday, October 15, 2006
Since Python 2.5, dict types provide a hook __missing__ method, to be called when a key is not found. It can be used to implement some fancy dictionary types. However, sometimes it's error-prone that only mydict[key] may trigger this method while mydict.get(key) will NOT, which leads to inconsistent semantics.