On Jul 7, 2005, at 8:57 PM, Neil Schemenauer wrote:
> On Thu, Jul 07, 2005 at 08:55:10PM +0200, Mario Ruggier wrote:
>> Shall I consider hashing the keys myself? I am not sure what the
>> implications are to my code...
>
> You need to have a __cmp__ method that provides a stable total
> ordering of the keys. It must still give the same order after keys
> are pickled and loaded.
Awesome... that's easy enough!
def __cmp__(self, other):
if self is other:
return 0
return cmp(self._id, other._id)
And, after rebuilding the indices:
for item in btree_kb.items():
assert btree.get(item[0]) is not None
assert item[1] == btree.get(item[0])
gives no errors, for all containers!
It is hugely wonderful... ;-!
Isaac, thanks for the additional thoughts, and links...
mario