[Zodb-checkins] CVS: Zope3/src/zodb/btrees - BTreeModuleTemplate.c:1.3 BTreeTemplate.c:1.3 BucketTemplate.c:1.4 SetOpTemplate.c:1.3 SetTemplate.c:1.3 TreeSetTemplate.c:1.3 interfaces.py:1.8

Tim Peters tim.one@comcast.net
Fri, 21 Feb 2003 12:33:32 -0500


Update of /cvs-repository/Zope3/src/zodb/btrees
In directory cvs.zope.org:/tmp/cvs-serv15826/src/zodb/btrees

Modified Files:
	BTreeModuleTemplate.c BTreeTemplate.c BucketTemplate.c 
	SetOpTemplate.c SetTemplate.c TreeSetTemplate.c interfaces.py 
Log Message:
Steve Alexander made a strong case to Jim Fulton for extending BTree-ish
range searches to allow for the optional exclusion of an endpoint (like
finding all the items in a BTree with key strictly less than some path-
like string -- it can be very difficult to express this as a "less than
or equal to" range search).

This checkin doesn't implement that yet, but does the large amount of
mostly-mechanical fiddling needed just to give these methods keyword
arguments:

    keys()
for
    BTree, TreeSet, Bucket, Set

and

    values(), items()
for
    BTree, Bucket

and
    itervalues(), iteritems()
for
    BTree

and
    iterkeys()
for
    BTree, TreeSet

btrees/interfaces.py also documents the new interface (although, again,
it isn't yet implemented).


=== Zope3/src/zodb/btrees/BTreeModuleTemplate.c 1.2 => 1.3 ===
--- Zope3/src/zodb/btrees/BTreeModuleTemplate.c:1.2	Wed Dec 25 09:12:16 2002
+++ Zope3/src/zodb/btrees/BTreeModuleTemplate.c	Fri Feb 21 12:33:01 2003
@@ -332,6 +332,11 @@
     return r;
 }
 
+/* Shared keyword-argument list for BTree/Bucket
+ * (iter)?(keys|values|items)
+ */
+static char *search_keywords[] = {"min", "max", 0};
+
 #include "BTreeItemsTemplate.c"
 #include "BucketTemplate.c"
 #include "SetTemplate.c"


=== Zope3/src/zodb/btrees/BTreeTemplate.c 1.2 => 1.3 ===
--- Zope3/src/zodb/btrees/BTreeTemplate.c:1.2	Wed Dec 25 09:12:16 2002
+++ Zope3/src/zodb/btrees/BTreeTemplate.c	Fri Feb 21 12:33:01 2003
@@ -1374,7 +1374,7 @@
 **
 */
 static PyObject *
-BTree_rangeSearch(BTree *self, PyObject *args, char type)
+BTree_rangeSearch(BTree *self, PyObject *args, PyObject *kw, char type)
 {
   PyObject *f=0, *l=0;
   int rc;
@@ -1383,7 +1383,12 @@
   int lowoffset;
   int highoffset;
 
-  UNLESS (! args || PyArg_ParseTuple(args,"|OO",&f, &l)) return NULL;
+  if (args) {
+      if (! PyArg_ParseTupleAndKeywords(args, kw, "|OO",
+					search_keywords,
+					&f, &l))
+ 	  return NULL;
+  }
 
   PyPersist_INCREF(self);
   if (!PyPersist_IS_STICKY(self))
@@ -1501,27 +1506,27 @@
 ** BTree_keys
 */
 static PyObject *
-BTree_keys(BTree *self, PyObject *args)
+BTree_keys(BTree *self, PyObject *args, PyObject *kw)
 {
-    return BTree_rangeSearch(self, args, 'k');
+    return BTree_rangeSearch(self, args, kw, 'k');
 }
 
 /*
 ** BTree_values
 */
 static PyObject *
-BTree_values(BTree *self, PyObject *args)
+BTree_values(BTree *self, PyObject *args, PyObject *kw)
 {
-    return BTree_rangeSearch(self, args, 'v');
+    return BTree_rangeSearch(self, args, kw, 'v');
 }
 
 /*
 ** BTree_items
 */
 static PyObject *
-BTree_items(BTree *self, PyObject *args)
+BTree_items(BTree *self, PyObject *args, PyObject *kw)
 {
-    return BTree_rangeSearch(self, args, 'i');
+    return BTree_rangeSearch(self, args, kw, 'i');
 }
 
 static PyObject *
@@ -1542,7 +1547,7 @@
 
   UNLESS (r=PyList_New(0)) goto err;
 
-  it.set=BTree_rangeSearch(self, NULL, 'i');
+  it.set=BTree_rangeSearch(self, NULL, NULL, 'i');
   UNLESS(it.set) goto err;
 
   if (nextBTreeItems(&it) < 0) goto err;
@@ -1660,10 +1665,10 @@
  * Returns a BTreeIter object, or NULL if error.
  */
 static PyObject *
-buildBTreeIter(BTree *self, PyObject *args, char kind)
+buildBTreeIter(BTree *self, PyObject *args, PyObject *kw, char kind)
 {
     BTreeIter *result = NULL;
-    BTreeItems *items = (BTreeItems *)BTree_rangeSearch(self, args, kind);
+    BTreeItems *items = (BTreeItems *)BTree_rangeSearch(self, args, kw, kind);
 
     if (items) {
         result = BTreeIter_new(items);
@@ -1676,28 +1681,28 @@
 static PyObject *
 BTree_getiter(BTree *self)
 {
-    return buildBTreeIter(self, NULL, 'k');
+    return buildBTreeIter(self, NULL, NULL, 'k');
 }
 
 /* The implementation of BTree.iterkeys(). */
 static PyObject *
-BTree_iterkeys(BTree *self, PyObject *args)
+BTree_iterkeys(BTree *self, PyObject *args, PyObject *kw)
 {
-    return buildBTreeIter(self, args, 'k');
+    return buildBTreeIter(self, args, kw, 'k');
 }
 
 /* The implementation of BTree.itervalues(). */
 static PyObject *
-BTree_itervalues(BTree *self, PyObject *args)
+BTree_itervalues(BTree *self, PyObject *args, PyObject *kw)
 {
-    return buildBTreeIter(self, args, 'v');
+    return buildBTreeIter(self, args, kw, 'v');
 }
 
 /* The implementation of BTree.iteritems(). */
 static PyObject *
-BTree_iteritems(BTree *self, PyObject *args)
+BTree_iteritems(BTree *self, PyObject *args, PyObject *kw)
 {
-    return buildBTreeIter(self, args, 'i');
+    return buildBTreeIter(self, args, kw, 'i');
 }
 
 /* End of iterator support. */
@@ -1720,61 +1725,79 @@
     {"__getstate__", (PyCFunction) BTree_getstate,	METH_NOARGS,
      "__getstate__() -> state\n\n"
      "Return the picklable state of the BTree."},
+
     {"__setstate__", (PyCFunction) BTree_setstate,	METH_O,
      "__setstate__(state)\n\n"
      "Set the state of the BTree."},
+
     {"has_key",	(PyCFunction) BTree_has_key,	METH_O,
      "has_key(key)\n\n"
      "Return true if the BTree contains the given key."},
-    {"keys",	(PyCFunction) BTree_keys,	METH_VARARGS,
+
+    {"keys",	(PyCFunction) BTree_keys,	METH_KEYWORDS,
      "keys([min, max]) -> list of keys\n\n"
      "Returns the keys of the BTree.  If min and max are supplied, only\n"
      "keys greater than min and less than max are returned."},
-    {"values",	(PyCFunction) BTree_values,	METH_VARARGS,
+
+    {"values",	(PyCFunction) BTree_values,	METH_KEYWORDS,
      "values([min, max]) -> list of values\n\n"
      "Returns the values of the BTree.  If min and max are supplied, only\n"
      "values corresponding to keys greater than min and less than max are\n"
      "returned."},
-    {"items",	(PyCFunction) BTree_items,	METH_VARARGS,
+
+    {"items",	(PyCFunction) BTree_items,	METH_KEYWORDS,
      "items([min, max]) -> -- list of key, value pairs\n\n"
      "Returns the items of the BTree.  If min and max are supplied, only\n"
      "items with keys greater than min and less than max are returned."},
+
     {"byValue",	(PyCFunction) BTree_byValue,	METH_O,
      "byValue(min) ->  list of value, key pairs\n\n"
      "Returns list of value, key pairs where the value is >= min.  The\n"
      "list is sorted by value.  Note that items() returns keys in the\n"
      "opposite order."},
+
     {"get",	(PyCFunction) BTree_getm,	METH_VARARGS,
      "get(key[, default=None]) -> Value for key or default\n\n"
      "Return the value or the default if the key is not found."},
+
     {"maxKey", (PyCFunction) BTree_maxKey,	METH_VARARGS,
      "maxKey([max]) -> key\n\n"
      "Return the largest key in the BTree.  If max is specified, return\n"
      "the largest key <= max."},
+
     {"minKey", (PyCFunction) BTree_minKey,	METH_VARARGS,
      "minKey([mi]) -> key\n\n"
      "Return the smallest key in the BTree.  If min is specified, return\n"
      "the smallest key >= min."},
+
     {"clear",	(PyCFunction) BTree_clear,	METH_NOARGS,
      "clear()\n\nRemove all of the items from the BTree."},
+
     {"insert", (PyCFunction)BTree_addUnique, METH_VARARGS,
      "insert(key, value) -> 0 or 1\n\n"
      "Add an item if the key is not already used. Return 1 if the item was\n"
      "added, or 0 otherwise."},
+
     {"update",	(PyCFunction) Mapping_update,	METH_O,
      "update(collection)\n\n Add the items from the given collection."},
-    {"iterkeys", (PyCFunction) BTree_iterkeys,  METH_VARARGS,
+
+    {"iterkeys", (PyCFunction) BTree_iterkeys,  METH_KEYWORDS,
      "B.iterkeys([min[,max]]) -> an iterator over the keys of B"},
-    {"itervalues", (PyCFunction) BTree_itervalues,  METH_VARARGS,
+
+    {"itervalues", (PyCFunction) BTree_itervalues,  METH_KEYWORDS,
      "B.itervalues([min[,max]]) -> an iterator over the values of B"},
-    {"iteritems", (PyCFunction) BTree_iteritems,    METH_VARARGS,
+
+    {"iteritems", (PyCFunction) BTree_iteritems,    METH_KEYWORDS,
      "B.iteritems([min[,max]]) -> an iterator over the (key, value) items of B"},
+
     {"_check", (PyCFunction) BTree_check,       METH_NOARGS,
      "Perform sanity check on BTree, and raise exception if flawed."},
+
 #ifdef PERSISTENT
     {"_p_resolveConflict", (PyCFunction) BTree__p_resolveConflict,
      METH_VARARGS,
      "_p_resolveConflict() -- Reinitialize from a newly created copy"},
+
     {"_p_deactivate", (PyCFunction) BTree__p_deactivate,	METH_NOARGS,
      "_p_deactivate()\n\nReinitialize from a newly created copy."},
 #endif


=== Zope3/src/zodb/btrees/BucketTemplate.c 1.3 => 1.4 ===
--- Zope3/src/zodb/btrees/BucketTemplate.c:1.3	Sat Jan 11 01:35:04 2003
+++ Zope3/src/zodb/btrees/BucketTemplate.c	Fri Feb 21 12:33:01 2003
@@ -709,12 +709,17 @@
 }
 
 static int
-Bucket_rangeSearch(Bucket *self, PyObject *args, int *low, int *high)
+Bucket_rangeSearch(Bucket *self, PyObject *args, PyObject *kw,
+		   int *low, int *high)
 {
   PyObject *f=0, *l=0;
   int rc;
 
-  if (args && ! PyArg_ParseTuple(args,"|OO",&f, &l)) return -1;
+  if (args) {
+      if (! PyArg_ParseTupleAndKeywords(args, kw, "|OO", search_keywords,
+      					&f,  &l))
+      return -1;
+  }
 
   UNLESS (self->len) goto empty;
 
@@ -761,14 +766,14 @@
 ** Returns:	list of bucket keys
 */
 static PyObject *
-bucket_keys(Bucket *self, PyObject *args)
+bucket_keys(Bucket *self, PyObject *args, PyObject *kw)
 {
   PyObject *r = NULL, *key;
   int i, low, high;
 
   PER_USE_OR_RETURN(self, NULL);
 
-  if (Bucket_rangeSearch(self, args, &low, &high) < 0)
+  if (Bucket_rangeSearch(self, args, kw, &low, &high) < 0)
       goto err;
 
   r = PyList_New(high-low+1);
@@ -803,14 +808,14 @@
 ** Returns	list of values
 */
 static PyObject *
-bucket_values(Bucket *self, PyObject *args)
+bucket_values(Bucket *self, PyObject *args, PyObject *kw)
 {
   PyObject *r=0, *v;
   int i, low, high;
 
   PER_USE_OR_RETURN(self, NULL);
 
-  if (Bucket_rangeSearch(self, args, &low, &high) < 0) goto err;
+  if (Bucket_rangeSearch(self, args, kw, &low, &high) < 0) goto err;
 
   UNLESS (r=PyList_New(high-low+1)) goto err;
 
@@ -843,14 +848,14 @@
 ** Returns:	list of all items in the bucket
 */
 static PyObject *
-bucket_items(Bucket *self, PyObject *args)
+bucket_items(Bucket *self, PyObject *args, PyObject *kw)
 {
   PyObject *r=0, *o=0, *item=0;
   int i, low, high;
 
   PER_USE_OR_RETURN(self, NULL);
 
-  if (Bucket_rangeSearch(self, args, &low, &high) < 0) goto err;
+  if (Bucket_rangeSearch(self, args, kw, &low, &high) < 0) goto err;
 
   UNLESS (r=PyList_New(high-low+1)) goto err;
 
@@ -1246,14 +1251,15 @@
  * Returns a BTreeIter object, or NULL if error.
  */
 static PyObject *
-buildBucketIter(Bucket *self, PyObject *args, char kind)
+buildBucketIter(Bucket *self, PyObject *args, PyObject *kw, char kind)
 {
     BTreeItems *items;
     int lowoffset, highoffset;
     BTreeIter *result = NULL;
 
     PER_USE_OR_RETURN(self, NULL);
-    if (Bucket_rangeSearch(self, args, &lowoffset, &highoffset) < 0) goto Done;
+    if (Bucket_rangeSearch(self, args, kw, &lowoffset, &highoffset) < 0)
+        goto Done;
 
     items = (BTreeItems *)newBTreeItems(kind, self, lowoffset,
                                               self, highoffset);
@@ -1271,28 +1277,28 @@
 static PyObject *
 Bucket_getiter(Bucket *self)
 {
-    return buildBucketIter(self, NULL, 'k');
+    return buildBucketIter(self, NULL, NULL, 'k');
 }
 
 /* The implementation of Bucket.iterkeys(). */
 static PyObject *
-Bucket_iterkeys(Bucket *self, PyObject *args)
+Bucket_iterkeys(Bucket *self, PyObject *args, PyObject *kw)
 {
-    return buildBucketIter(self, args, 'k');
+    return buildBucketIter(self, args, kw, 'k');
 }
 
 /* The implementation of Bucket.itervalues(). */
 static PyObject *
-Bucket_itervalues(Bucket *self, PyObject *args)
+Bucket_itervalues(Bucket *self, PyObject *args, PyObject *kw)
 {
-    return buildBucketIter(self, args, 'v');
+    return buildBucketIter(self, args, kw, 'v');
 }
 
 /* The implementation of Bucket.iteritems(). */
 static PyObject *
-Bucket_iteritems(Bucket *self, PyObject *args)
+Bucket_iteritems(Bucket *self, PyObject *args, PyObject *kw)
 {
-    return buildBucketIter(self, args, 'i');
+    return buildBucketIter(self, args, kw, 'i');
 }
 
 /* End of iterator support. */
@@ -1378,42 +1384,58 @@
 static struct PyMethodDef Bucket_methods[] = {
     {"__getstate__", (PyCFunction) bucket_getstate,	METH_NOARGS,
      "__getstate__() -- Return the picklable state of the object"},
+
     {"__setstate__", (PyCFunction) bucket_setstate,	METH_O,
      "__setstate__() -- Set the state of the object"},
-    {"keys",	(PyCFunction) bucket_keys,	METH_VARARGS,
+
+    {"keys",	(PyCFunction) bucket_keys,	METH_KEYWORDS,
      "keys([min, max]) -- Return the keys"},
+
     {"has_key",	(PyCFunction) bucket_has_key,	METH_O,
      "has_key(key) -- Test whether the bucket contains the given key"},
+
     {"clear",	(PyCFunction) bucket_clear,	METH_VARARGS,
      "clear() -- Remove all of the items from the bucket"},
+
     {"update",	(PyCFunction) Mapping_update,	METH_O,
      "update(collection) -- Add the items from the given collection"},
+
     {"maxKey", (PyCFunction) Bucket_maxKey,	METH_VARARGS,
      "maxKey([key]) -- Fine the maximum key\n\n"
      "If an argument is given, find the maximum <= the argument"},
+
     {"minKey", (PyCFunction) Bucket_minKey,	METH_VARARGS,
      "minKey([key]) -- Fine the minimum key\n\n"
      "If an argument is given, find the minimum >= the argument"},
-    {"values",	(PyCFunction) bucket_values,	METH_VARARGS,
+
+    {"values",	(PyCFunction) bucket_values,	METH_KEYWORDS,
      "values([min, max]) -- Return the values"},
-    {"items",	(PyCFunction) bucket_items,	METH_VARARGS,
+
+    {"items",	(PyCFunction) bucket_items,	METH_KEYWORDS,
      "items([min, max])) -- Return the items"},
+
     {"byValue",	(PyCFunction) bucket_byValue,	METH_O,
      "byValue(min) -- "
      "Return value-keys with values >= min and reverse sorted by values"},
+
     {"get",	(PyCFunction) bucket_getm,	METH_VARARGS,
      "get(key[,default]) -- Look up a value\n\n"
      "Return the default (or None) if the key is not found."},
-    {"iterkeys", (PyCFunction) Bucket_iterkeys,  METH_VARARGS,
+
+    {"iterkeys", (PyCFunction) Bucket_iterkeys,  METH_KEYWORDS,
      "B.iterkeys([min[,max]]) -> an iterator over the keys of B"},
-    {"itervalues", (PyCFunction) Bucket_itervalues,  METH_VARARGS,
+
+    {"itervalues", (PyCFunction) Bucket_itervalues,  METH_KEYWORDS,
      "B.itervalues([min[,max]]) -> an iterator over the values of B"},
-    {"iteritems", (PyCFunction) Bucket_iteritems,    METH_VARARGS,
+
+    {"iteritems", (PyCFunction) Bucket_iteritems,    METH_KEYWORDS,
      "B.iteritems([min[,max]]) -> an iterator over the (key, value) items of B"},
+
 #ifdef PERSISTENT
     {"_p_resolveConflict", (PyCFunction) bucket__p_resolveConflict,
      METH_VARARGS,
      "_p_resolveConflict() -- Reinitialize from a newly created copy"},
+
     {"_p_deactivate", (PyCFunction) bucket__p_deactivate, METH_NOARGS,
      "_p_deactivate() -- Reinitialize from a newly created copy"},
 #endif
@@ -1551,7 +1573,7 @@
     char repr[10000];
     int rv;
 
-    i = bucket_items(self, NULL);
+    i = bucket_items(self, NULL, NULL);
     if (!i)
 	return NULL;
     r = PyObject_Repr(i);


=== Zope3/src/zodb/btrees/SetOpTemplate.c 1.2 => 1.3 ===
--- Zope3/src/zodb/btrees/SetOpTemplate.c:1.2	Wed Dec 25 09:12:16 2002
+++ Zope3/src/zodb/btrees/SetOpTemplate.c	Fri Feb 21 12:33:01 2003
@@ -124,7 +124,7 @@
     }
   else if (PyObject_IsInstance(s, (PyObject *)&BTreeType))
     {
-      i->set = BTree_rangeSearch(BTREE(s), NULL, 'i');
+      i->set = BTree_rangeSearch(BTREE(s), NULL, NULL, 'i');
       UNLESS(i->set) return -1;
 
       if (useValues)
@@ -137,7 +137,7 @@
     }
   else if (PyObject_IsInstance(s, (PyObject *)&TreeSetType))
     {
-      i->set = BTree_rangeSearch(BTREE(s), NULL, 'k');
+      i->set = BTree_rangeSearch(BTREE(s), NULL, NULL, 'k');
       UNLESS(i->set) return -1;
       i->next = nextTreeSetItems;
     }


=== Zope3/src/zodb/btrees/SetTemplate.c 1.2 => 1.3 ===
--- Zope3/src/zodb/btrees/SetTemplate.c:1.2	Wed Dec 25 09:12:16 2002
+++ Zope3/src/zodb/btrees/SetTemplate.c	Fri Feb 21 12:33:01 2003
@@ -168,30 +168,41 @@
 static struct PyMethodDef Set_methods[] = {
   {"__getstate__", (PyCFunction) bucket_getstate,	METH_VARARGS,
    "__getstate__() -- Return the picklable state of the object"},
+
   {"__setstate__", (PyCFunction) set_setstate,	METH_VARARGS,
    "__setstate__() -- Set the state of the object"},
-  {"keys",	(PyCFunction) bucket_keys,	METH_VARARGS,
+
+  {"keys",	(PyCFunction) bucket_keys,	METH_KEYWORDS,
      "keys() -- Return the keys"},
+
   {"has_key",	(PyCFunction) bucket_has_key,	METH_O,
      "has_key(key) -- Test whether the bucket contains the given key"},
+
   {"clear",	(PyCFunction) bucket_clear,	METH_VARARGS,
    "clear() -- Remove all of the items from the bucket"},
+
   {"maxKey", (PyCFunction) Bucket_maxKey,	METH_VARARGS,
-   "maxKey([key]) -- Fine the maximum key\n\n"
+   "maxKey([key]) -- Find the maximum key\n\n"
    "If an argument is given, find the maximum <= the argument"},
+
   {"minKey", (PyCFunction) Bucket_minKey,	METH_VARARGS,
-   "minKey([key]) -- Fine the minimum key\n\n"
+   "minKey([key]) -- Find the minimum key\n\n"
    "If an argument is given, find the minimum >= the argument"},
+
 #ifdef PERSISTENT
   {"_p_resolveConflict", (PyCFunction) bucket__p_resolveConflict, METH_VARARGS,
    "_p_resolveConflict() -- Reinitialize from a newly created copy"},
+
   {"_p_deactivate", (PyCFunction) bucket__p_deactivate, METH_VARARGS,
    "_p_deactivate() -- Reinitialize from a newly created copy"},
 #endif
+
   {"insert",	(PyCFunction)Set_insert,	METH_VARARGS,
    "insert(id,[ignored]) -- Add a key to the set"},
+
   {"update",	(PyCFunction)Set_update,	METH_VARARGS,
    "update(seq) -- Add the items from the given sequence to the set"},
+
   {"remove",	(PyCFunction)Set_remove,	METH_VARARGS,
    "remove(id) -- Remove an id from the set"},
 
@@ -222,11 +233,11 @@
 
   UNLESS (format) UNLESS (format=PyString_FromString(MOD_NAME_PREFIX "Set(%s)"))
     return NULL;
-  UNLESS (t=PyTuple_New(1)) return NULL;
-  UNLESS (r=bucket_keys(self,NULL)) goto err;
-  PyTuple_SET_ITEM(t,0,r);
-  r=t;
-  ASSIGN(r,PyString_Format(format,r));
+  UNLESS (t = PyTuple_New(1)) return NULL;
+  UNLESS (r = bucket_keys(self, NULL, NULL)) goto err;
+  PyTuple_SET_ITEM(t, 0, r);
+  r = t;
+  ASSIGN(r, PyString_Format(format, r));
   return r;
 err:
   Py_DECREF(t);


=== Zope3/src/zodb/btrees/TreeSetTemplate.c 1.2 => 1.3 ===
--- Zope3/src/zodb/btrees/TreeSetTemplate.c:1.2	Wed Dec 25 09:12:16 2002
+++ Zope3/src/zodb/btrees/TreeSetTemplate.c	Fri Feb 21 12:33:01 2003
@@ -118,37 +118,49 @@
   {"__getstate__", (PyCFunction) BTree_getstate,	METH_NOARGS,
    "__getstate__() -> state\n\n"
    "Return the picklable state of the TreeSet."},
+
   {"__setstate__", (PyCFunction) TreeSet_setstate,	METH_VARARGS,
    "__setstate__(state)\n\n"
    "Set the state of the TreeSet."},
+
   {"has_key",	(PyCFunction) BTree_has_key,	METH_O,
    "has_key(key)\n\n"
    "Return true if the TreeSet contains the given key."},
-  {"keys",	(PyCFunction) BTree_keys,	METH_VARARGS,
+
+  {"keys",	(PyCFunction) BTree_keys,	METH_KEYWORDS,
    "keys([min, max]) -> list of keys\n\n"
    "Returns the keys of the TreeSet.  If min and max are supplied, only\n"
    "keys greater than min and less than max are returned."},
+
   {"maxKey", (PyCFunction) BTree_maxKey,	METH_VARARGS,
    "maxKey([max]) -> key\n\n"
    "Return the largest key in the BTree.  If max is specified, return\n"
    "the largest key <= max."},
+
   {"minKey", (PyCFunction) BTree_minKey,	METH_VARARGS,
    "minKey([mi]) -> key\n\n"
    "Return the smallest key in the BTree.  If min is specified, return\n"
    "the smallest key >= min."},
+
   {"clear",	(PyCFunction) BTree_clear,	METH_NOARGS,
    "clear()\n\nRemove all of the items from the BTree."},
+
   {"insert",	(PyCFunction)TreeSet_insert,	METH_VARARGS,
    "insert(id,[ignored]) -- Add an id to the set"},
+
   {"update",	(PyCFunction)TreeSet_update,	METH_VARARGS,
    "update(collection)\n\n Add the items from the given collection."},
+
   {"remove",	(PyCFunction)TreeSet_remove,	METH_VARARGS,
    "remove(id) -- Remove a key from the set"},
+
   {"_check", (PyCFunction) BTree_check,       METH_NOARGS,
    "Perform sanity check on TreeSet, and raise exception if flawed."},
+
 #ifdef PERSISTENT
   {"_p_resolveConflict", (PyCFunction) BTree__p_resolveConflict, METH_VARARGS,
    "_p_resolveConflict() -- Reinitialize from a newly created copy"},
+
   {"_p_deactivate", (PyCFunction) BTree__p_deactivate,	METH_NOARGS,
    "_p_deactivate()\n\nReinitialize from a newly created copy."},
 #endif


=== Zope3/src/zodb/btrees/interfaces.py 1.7 => 1.8 ===
--- Zope3/src/zodb/btrees/interfaces.py:1.7	Fri Jan 17 11:44:33 2003
+++ Zope3/src/zodb/btrees/interfaces.py	Fri Feb 21 12:33:01 2003
@@ -98,20 +98,26 @@
     def has_key(key):
         """Check whether the object has an item with the given key"""
 
-    def keys(min=None, max=None):
-        """Return an IReadSequence containing the keys in the collection
+    def keys(min=None, max=None, excludemin=False, excludemax=False):
+        """Return an IReadSequence containing the keys in the collection.
 
-        The type of the IReadSequence is not specified. It could be a
-        list or a tuple or some other type.
+        The type of the IReadSequence is not specified. It could be a list
+        or a tuple or some other type.
 
-        If a min is specified, then output is constrained to
-        items having keys greater than or equal to the given min.
-        A min value of None is ignored.
-
-        If a max is specified, then output is constrained to
-        items having keys less than or equal to the given min.
-        A max value of None is ignored.
-        """
+        All arguments are optional, and may be specified as keyword
+        arguments, or by position.
+
+        If a min is specified, then output is constrained to keys greater
+        than or equal to the given min, and, if excludemin is specified and
+        true, is further constrained to keys strictly greater than min.  A
+        min value of None is ignored.  If min is None or not specified, and
+        excludemin is true, the smallest key is excluded.
+
+        If a max is specified, then output is constrained to keys less than
+        or equal to the given max, and, if excludemax is specified and
+        true, is further constrained to keys strictly less than max.  A max
+        value of None is ignored.  If max is None or not specified, and
+        excludemax is true, the largest key is excluded. """
 
     def maxKey(key=None):
         """Return the maximum key
@@ -167,36 +173,54 @@
         key-value tuples.
         """
 
-    def values(min=None, max=None):
-        """Return a IReadSequence containing the values in the collection
-
-        The type of the IReadSequence is not specified. It could be a
-        list or a tuple or some other type.
-
-        If a min is specified, then output is constrained to
-        items having keys greater than or equal to the given min.
-        A min value of None is ignored.
-
-        If a max is specified, then output is constrained to
-        items having keys less than or equal to the given max.
-        A max value of None is ignored.
-        """
-
-    def items(min=None, max=None):
-        """Return a IReadSequence containing the items in the collection
-
-        An item is a key-value tuple.
+    def values(min=None, max=None, excludemin=False, excludemax=False):
+        """Return an IReadSequence containing the values in the collection.
 
-        The type of the IReadSequence is not specified. It could be a
-        list or a tuple or some other type.
+        The type of the IReadSequence is not specified. It could be a list
+        or a tuple or some other type.
 
-        If a min is specified, then output is constrained to
-        items having keys greater than or equal to the given min.
-        A min value of None is ignored.
+        All arguments are optional, and may be specified as keyword
+        arguments, or by position.
 
-        If a max is specified, then output is constrained to
-        items having keys less than or equal to the given max.
-        A max value of None is ignored.
+        If a min is specified, then output is constrained to values whose
+        keys are greater than or equal to the given min, and, if excludemin
+        is specified and true, is further constrained to values whose keys
+        are strictly greater than min.  A min value of None is ignored.  If
+        min is None or not specified, and excludemin is true, the value
+        corresponding to the smallest key is excluded.
+
+        If a max is specified, then output is constrained to values whose
+        keys are less than or equal to the given max, and, if excludemax is
+        specified and true, is further constrained to values whose keys are
+        strictly less than max.  A max value of None is ignored.  If max is
+        None or not specified, and excludemax is true, the value
+        corresponding to the largest key is excluded.
+        """
+
+    def items(min=None, max=None, excludemin=False, excludemax=False):
+        """Return an IReadSequence containing the items in the collection.
+
+        An item is a 2-tuple, a (key, value) pair.
+
+        The type of the IReadSequence is not specified.  It could be a list
+        or a tuple or some other type.
+
+        All arguments are optional, and may be specified as keyword
+        arguments, or by position.
+
+        If a min is specified, then output is constrained to items whose
+        keys are greater than or equal to the given min, and, if excludemin
+        is specified and true, is further constrained to items whose keys
+        are strictly greater than min.  A min value of None is ignored.  If
+        min is None or not specified, and excludemin is true, the item with
+        the smallest key is excluded.
+
+        If a max is specified, then output is constrained to items whose
+        keys are less than or equal to the given max, and, if excludemax is
+        specified and true, is further constrained to items whose keys are
+        strictly less than max.  A max value of None is ignored.  If max is
+        None or not specified, and excludemax is true, the item with the
+        largest key is excluded.
         """
 
     def byValue(minValue):