[ZODB-Dev] Re: SVN:
ZODB/branches/anguenot-ordering-beforecommitsubscribers/src/transaction/_transaction.py
Implement the sort and insert using bisect.insort()
Tim Peters
tim at zope.com
Wed Aug 10 15:24:53 EDT 2005
[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.
More information about the ZODB-Dev
mailing list