[Zope3-checkins] SVN: Zope3/trunk/src/zope/interface/common/sequence.py fix the IMinimalSequence interface

Fred L. Drake, Jr. fdrake at gmail.com
Thu Nov 16 14:37:43 EST 2006


Log message for revision 71145:
  fix the IMinimalSequence interface

Changed:
  U   Zope3/trunk/src/zope/interface/common/sequence.py

-=-
Modified: Zope3/trunk/src/zope/interface/common/sequence.py
===================================================================
--- Zope3/trunk/src/zope/interface/common/sequence.py	2006-11-16 08:25:53 UTC (rev 71144)
+++ Zope3/trunk/src/zope/interface/common/sequence.py	2006-11-16 19:37:42 UTC (rev 71145)
@@ -19,16 +19,26 @@
 from zope import interface
 
 class IMinimalSequence(interface.Interface):
+    """Most basic sequence interface.
 
+    All sequences are iterable.  This requires at least one of the
+    following:
+
+    - a `__getitem__()` method that takes a single argument; interger
+      values starting at 0 must be supported, and `IndexError` should
+      be raised for the first index for which there is no value, or
+
+    - an `__iter__()` method that returns an iterator as defined in
+      the Python documentation (http://docs.python.org/lib/typeiter.html).
+
+    """
+
     def __getitem__(index):
         """`x.__getitem__(index)` <==> `x[index]`
 
         Declaring this interface does not specify whether `__getitem__`
         supports slice objects."""
 
-    def __iter__():
-        """`x.__iter__()` <==> `iter(x)`"""
-
 class IFiniteSequence(IMinimalSequence):
 
     def __len__():



More information about the Zope3-Checkins mailing list