Re: [Python-Dev] getdefault(), the real replacement for setdefault()

2006-02-24 Thread Barry Warsaw
On Feb 23, 2006, at 4:41 PM, Thomas Wouters wrote: > 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 >

Re: [Python-Dev] getdefault(), the real replacement for setdefault()

2006-02-23 Thread Thomas Wouters
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)

[Python-Dev] getdefault(), the real replacement for setdefault()

2006-02-22 Thread Barry Warsaw
Guido's on_missing() proposal is pretty good for what it is, but it is not a replacement for set_default(). The use cases for a derivable, definition or instantiation time framework is different than the call-site based decision being made with setdefault(). The difference is that in the former c