[ZODB-Dev] BTrees and Mutables, was Re: [IndexedCatalog] bug in default indexing

Christian Reis kiko@async.com.br
Mon, 3 Mar 2003 17:14:23 -0300


On Mon, Mar 03, 2003 at 02:00:02PM -0500, Nicholas Henke wrote:
> > > +            index[value] = idx
> > > +            idx.append(object)
> > 
> > Shouldn't these two lines be reversed?
> 
> Nope -- here is a wuote from the ZODB part of this thread ( the Re:
> [ZODB-Dev] BTrees and Mutables). This is from Shane Hathaway, dated
> 16.21 03/02/11
> 
> That's correct, although the purist way is like this:
> 
>      l = tree['bar']
>      tree['bar'] = l
>      l.append(4)
> 
> That way the notification happens before the actual change.  If an 
> exception happens and the transaction is aborted, the changed list will 
> be reverted.

Hmmm. I wonder if this means that the append() can raise an exception.

I don't understand how this could make any difference. Which instruction
might trigger an exception? What should it matter if abort() is issued
-- the state will be reset to the original state anyway, won't it?

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL