[prev in list] [next in list] [prev in thread] [next in thread]
List: zodb-dev
Subject: Re: [ZODB-Dev] BTree.setdefault(), BTree.pop()
From: Christian Robottom Reis <kiko () async ! com ! br>
Date: 2004-10-05 14:55:04
Message-ID: 20041005145504.GC12992 () www ! async ! com ! br
[Download RAW message or body]
On Mon, Oct 04, 2004 at 02:42:08PM -0400, Jeremy Hylton wrote:
> On Mon, 4 Oct 2004 19:25:54 +0200, Dieter Maurer <dieter@handshake.de> wrote:
> > Tim Peters wrote at 2004-10-4 11:45 -0400:
> > > ...
> > > pl = t.get(key)
> > > if pl is None:
> > > pl = t[key] = PersistentList()
> > > pl.append(value)
> > >
> > >So I'm -0 on the idea, because I doubt it will be used. I understand that
> > >you think you'll use it. Anyone else?
> >
> > I avoid "setdefault" almost always.
>
> I've written some code using setdefault() recently, but I'm not
> satisfied with it. There was a thread on python-dev several months
> ago where someone suggested a way to provide a factory for default
> values. That seems like a cleaner API if you were going to add this
> feature.
+1; it's definitely the right way to do it. setdefault is both confusing
and wasteful in most cases I've seen IRL.
Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/
ZODB-Dev mailing list - ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic