[ZODB-Dev] RE: B-Tree API - again!

Gfeller Martin Martin.Gfeller@comit.ch
Fri, 6 Dec 2002 16:28:34 +0100


Sorry to be re-iterate my question, but all the interesting answers do =
not address our concern, namely to have a compatible interface between =
B-Tree and PersistentMapping/dictionary.=20

Our aim is to replace PersistentMappings by OOBTrees in a large body of =
existing code, so we would profit from a do-nothing sort() method on the =
OOBTreeItems object returned by keys().=20

Thank you for looking at it again,
Martin Gfeller

_______________________=20

COMIT Gruppe=20
Risk Advice Services=20
CH-8004 Z=FCrich=20

http://www.comit.ch=20
http://www.quantax.com - Quantax Professional - Downsized Trading and =
Risk System





-----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