On 2007-07-20, Alex Popescu <[EMAIL PROTECTED]> wrote: > Hi all! > > I am pretty sure this has been asked a couple of times, but I > don't seem to find it on the archives (Google seems to have a > couple of problems lately). > > I am wondering what is the most pythonic way of dealing with missing > keys and default values. > > According to my readings one can take the following approaches:
There's also the popular collections.defaultdict. Usually, the get method of normal dicts is what I want. I use a defaultdict only when the implicit addition to the dictionary of defaulted elements is what I really want. -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list