[Zodb-checkins] CVS: ZODB3 - NEWS.txt:1.33.4.1
Tim Peters
tim.one at comcast.net
Wed Jul 16 18:43:56 EDT 2003
Update of /cvs-repository/ZODB3
In directory cvs.zope.org:/tmp/cvs-serv26748
Modified Files:
Tag: zodb33-devel-branch
NEWS.txt
Log Message:
Added a start at a 3.3a1 section, with details about new (for the ZODB3
line -- these were backported from the ZODB4 line) BTree features.
=== ZODB3/NEWS.txt 1.33 => 1.33.4.1 ===
--- ZODB3/NEWS.txt:1.33 Mon Jun 16 17:43:55 2003
+++ ZODB3/NEWS.txt Wed Jul 16 17:43:52 2003
@@ -1,3 +1,82 @@
+What's new in ZODB3 3.3 alpha 1
+===============================
+Release date: 17-Jul-2003
+
+New features in BTrees
+======================
+
+BTree, Bucket, TreeSet and Set objects are now iterable objects, playing
+nicely with the iteration protocol introduced in Python 2.2, and can
+be used in any context that accepts an iterable object. As for Python
+dicts, the iterator constructed for BTrees and Buckets iterates
+over the keys.
+
+>>> from BTrees.OOBTree import OOBTree
+>>> b = OOBTree({"one": 1, "two": 2, "three": 3, "four": 4})
+>>> for key in b: # iterates over the keys
+... print key
+four
+one
+three
+two
+>>> list(enumerate(b))
+[(0, 'four'), (1, 'one'), (2, 'three'), (3, 'two')]
+>>> i = iter(b)
+>>> i.next()
+'four'
+>>> i.next()
+'one'
+>>> i.next()
+'three'
+>>> i.next()
+'two'
+>>>
+
+As for Python dicts in 2.2, BTree and Bucket objects have new
+.iterkeys(), .iteritems(), and .itervalues() methods. TreeSet and Set
+objects have a new .iterkeys() method. Unlike as for Python dicts,
+these new methods accept optional min and max arguments to effect
+range searches. While Bucket.keys() produces a list, Bucket.iterkeys()
+produces an iterator, and similarly for Bucket values() versus
+itervalues(), Bucket items() versus iteritems(), and Set keys() versus
+iterkeys(). The iter{keys,values,items} methods of BTrees and the
+iterkeys() method of Treesets also produce iterators, while their
+keys() (etc) methods continue to produce BTreeItems objects (a form of
+"lazy" iterator that predates Python 2.2's iteration protocol).
+
+>>> sum(b.itervalues())
+10
+>>> zip(b.itervalues(), b.iterkeys())
+[(4, 'four'), (1, 'one'), (3, 'three'), (2, 'two')]
+>>>
+
+BTree, Bucket, TreeSet and Set objects also implement the __contains__
+method new in Python 2.2, which means that testing for key membership
+can be done directly now via the "in" and "not in" operators:
+
+>>> "won" in b
+False
+>>> "won" not in b
+True
+>>> "one" in b
+True
+>>>
+
+All old and new range-search methods now accept keyword arguments,
+and new optional excludemin and excludemax keyword arguments. The
+new keyword arguments allow doing a range search that's exclusive
+at one or both ends (doesn't include min, and/or doesn't include
+max).
+
+>>> list(b.keys())
+['four', 'one', 'three', 'two']
+>>> list(b.keys(max='three'))
+['four', 'one', 'three']
+>>> list(b.keys(max='three', excludemax=True))
+['four', 'one']
+>>>
+
+
What's new in ZODB3 3.2 beta 2
==============================
Release date: 16-Jun-2003
@@ -74,7 +153,7 @@
The ZODB cache has fewer methods. It used to expose methods that
could mutate the dictionary, which allowed users to violate internal
-invariants.
+invariants.
ZConfig
-------
@@ -225,7 +304,7 @@
restarting clients.
The ZEO cache verification protocol was revised to require many fewer
-messages in cases where a client or server restarts quickly.
+messages in cases where a client or server restarts quickly.
The performance of full cache verification has improved dramatically.
XXX Get measurements from Jim -- somewhere in 2x-5x recall. The
More information about the Zodb-checkins
mailing list