[ZODB-Dev] Re: SVN:
ZODB/branches/anguenot-ordering-beforecommitsubscribers/src/transaction/_transaction.py
Implement the sort and insert using bisect.insort()
Florent Guillaume
fg at nuxeo.com
Thu Aug 11 06:03:02 EDT 2005
Tim Peters wrote:
> [Florent Guillaume]
>
>>Frankly I don't see the point of using bisect if you do a linear pass on
>>the list first. The original code was clearer and was faster.
>>
>>If you had a "natural" way of getting the index, then why not. But anyway
>>this kind of hook list will have only a few elements in it. Optimize
>>later.
>
>
> Optimization isn't the point: it's the purpose of bisect.insort() to
> maintain a sorted list, and trusting a standard library function to do its
> documented job is better for long-term reliability and readability than
> trying to roll our own inline.
>
> I agree the `index` computation here is overly complicated (in fact, I
> believe it's incorrect), but it doesn't need to be. I'll repair that.
I guess you could simply store and increment then index as an attribute of
the transaction, yes.
Florent
--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the ZODB-Dev
mailing list