Re: Fast Dictionary Access

2009-06-27 Thread Rachel P
[Thomas Lehmann] > In C++, programming STL you will use the insert method which always > provides a position and a flag which indicates whether the position > results from a new insertion or an exisiting element. Idea is to have > one search only. > > > if  data.has_key(key): >    value = data[key

Re: I need a dict that inherits its mappings

2009-06-25 Thread Rachel P
On Jun 25, 5:31 am, samwyse wrote: > I need a dict-like object that, if it doesn't contain a key, will > return the value from a "parent" object.   See: http://code.activestate.com/recipes/305268/ Also try subclassing dict and implementing a __missing__() method. Raymond -- http://mail.pytho