[ZODB-Dev] B-Tree API
Gfeller Martin
Martin.Gfeller@comit.ch
Tue, 3 Dec 2002 08:36:47 +0100
Thanks, Jeremy.
However, my aim was to replace PersistentMappings or dicts by Btrees
*without* changing=20
lots of existing application code. I don't see how the helper function
could help, as
I would need to change all code calling sort() on objects returned by
keys().
Best regards,
Martin
-----Original Message-----
From: Jeremy Hylton [mailto:jeremy@zope.com]=20
Sent: Tuesday, 03 Dec 2002 00:17
To: Gfeller Martin
Cc: zodb-dev@zope.org; Anderegg Hansjoerg
Subject: Re: [ZODB-Dev] B-Tree API
>>>>> "GFE" =3D=3D gfe <gfe@comit.ch> writes:
GFE> Any ideas? Ideally, I think a do-nothing sort() method should
GFE> be provided to achieve compatiblity with dictionaries and
GFE> PersistentMappings.
This doesn't sound like a very appealing idea. The items returned by
a BTree are not a list, and I don't see much value in making them look
more like builtin lists (the only object with a sort() method).
Perhaps you could write a sort() helper function that sorted a
sequence in place and then test explicitly for lists in that function.
def sort(seq):
if isinstance(seq, list):
seq.sort()
return seq
Jeremy