On Wed, Feb 22, 2006 at 10:29:08PM -0500, Barry Warsaw wrote:
> d.getdefault('foo', list).append('bar')

> Anyway, I don't think it's an either/or choice with Guido's subclass.
> Instead I think they are different use cases.  I would add getdefault()
> to the standard dict API, remove (eventually) setdefault(), and add
> Guido's subclass in a separate module.  But I /wouldn't/ clutter the
> built-in dict's API with on_missing().

+1. This is a much closer match to my own use of setdefault than Guido's
dict subtype. I'm +0 on the subtype, but I prefer the call-time decision on
whether to fall back to a default or not.

-- 
Thomas Wouters <[EMAIL PROTECTED]>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to