[ZODB-Dev] odd KeyError in OOSets

Tim Peters tim_one at email.msn.com
Fri Apr 18 20:00:01 EDT 2003


[Nicholas Henke]
> Just for fun I printed cmp(object,o) for each o in the OOSet:
>
> Obj: <ClubmaskObject node0 at 0x8321008> id: 137498632
> cmp: 10618
> Obj: <ClubmaskObject node6 at 0x83368c0> id: 137586880
> cmp: -1
> Obj: <ClubmaskObject node3 at 0x8335bd8> id: 137583576
> cmp: 0
> Obj: <ClubmaskObject node7 at 0x8337728> id: 137590568
> cmp: -1
> Obj: <ClubmaskObject node2 at 0x8338370> id: 137593712
> cmp: -1
> Obj: <ClubmaskObject node1 at 0x8339018> id: 137596952
> cmp: -1
> Obj: <ClubmaskObject node4 at 0x8339b70> id: 137599856
> cmp: -1
>
> Ok -- so it is in there :/

This must be a different example than the first one you posted (in that one
you were looking for something named "node2"; here you're getting a match on
"node3").

But the output confirms that you can't use instances of this class in a
persistent OOSet (see earlier mail) anyway:  the pattern of cmp results
confirms that the OOSet's elements aren't in sorted order anymore (object >
node0, and object < node6, but object doesn't lie between node0 and node6).
That's typical when persistent objects get new memory addresses upon loading
them from a database and the default __cmp__ is used to compare the
instances.




More information about the ZODB-Dev mailing list