[Florent Guillaume]
> I guess you could simply store and increment then index as an attribute
> of the transaction, yes.

Right!  That's an easy, "obviously correct" way to do it, and is the one I'd
probably do.

Another way is to define a little class to hold a hook's info, and give it a
__cmp__ method that only compares its arguments' order values.  Then using
bisect.insort_right() would guarantee to insert a new instance "at the right
end" of any existing slice of instances sharing the same order value.  That
way a serial number ("index") to break order ties wouldn't be needed at all.
So that's attractive too, but would be a little heavier to code.

Provided you understand the bisect module first, what's _hard_ is to do it
in a wrong way <0.9 wink>.

For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to