Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > David Isaac wrote: > >> Alan Isaac wrote: > >>> I have a subclass of dict where __getitem__ returns None rather than > >>> raising KeyError for missing keys. (The why of that is not important > > for > >>> this question.) > > > > "Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote: > >> Well, actually it may be important... What's so wrong with d.get('key') > >> that you need this behaviour ? > > > > I want to use the mapping with string interpolation. > > > Well, this makes sens... But then why not use a plain dict to collect > data, and wrap it in a special one just before using it for > interpolation ? ie:
Using a single container (and being able to modify and use it fluidly) is simply handier. That's what defaultdict in Python 2.5 is for, btw. Alex -- http://mail.python.org/mailman/listinfo/python-list