Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r55001:7af5293034d4
Date: 2012-05-10 08:42 +0200
http://bitbucket.org/pypy/pypy/changeset/7af5293034d4/

Log:    Comments

diff --git a/pypy/rlib/rshrinklist.py b/pypy/rlib/rshrinklist.py
--- a/pypy/rlib/rshrinklist.py
+++ b/pypy/rlib/rshrinklist.py
@@ -1,5 +1,12 @@
 
 class AbstractShrinkList(object):
+    """A mixin base class.  You should subclass it and add a method
+    must_keep().  Behaves like a list with the method append(), and
+    you can read *for reading* the list of items by calling items().
+    The twist is that occasionally append() will throw away the
+    items for which must_keep() returns False.  (It does so without
+    changing the order.)
+    """
     _mixin_ = True
 
     def __init__(self):
diff --git a/pypy/rlib/test/test_rshrinklist.py 
b/pypy/rlib/test/test_rshrinklist.py
--- a/pypy/rlib/test/test_rshrinklist.py
+++ b/pypy/rlib/test/test_rshrinklist.py
@@ -19,7 +19,7 @@
     l3 = [Item() for i in range(150 + 16)]
     for x in l3:
         l.append(x)
-    assert l.items() == l2[1::2] + l3
+    assert l.items() == l2[1::2] + l3   # keeps the order
 
 def test_append_dead_items():
     l = ItemList()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to