[Zope3-checkins]
SVN: Zope3/trunk/src/zope/interface/common/sequence.py
Add some useful sequence sub-interfaces.
Gary Poster
gary at zope.com
Mon Mar 7 13:17:24 EST 2005
Log message for revision 29404:
Add some useful sequence sub-interfaces.
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 2005-03-06 15:12:39 UTC (rev 29403)
+++ Zope3/trunk/src/zope/interface/common/sequence.py 2005-03-07 18:17:24 UTC (rev 29404)
@@ -17,15 +17,25 @@
"""
from zope import interface
-class IReadSequence(interface.Interface):
- "read interface shared by tuple and list"
+class IMinimalSequence(interface.Interface):
def __getitem__(index):
- "x.__getitem__(index) <==> x[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__():
+ "x.__len__() <==> len(x)"
+
+class IReadSequence(IFiniteSequence):
+ "read interface shared by tuple and list"
+
def __contains__(item):
"x.__contains__(item) <==> item in x"
@@ -47,9 +57,6 @@
def __ge__(other):
"x.__ge__(other) <==> x>=other"
- def __len__():
- "x.__len__() <==> len(x)"
-
def __add__(other):
"x.__add__(other) <==> x+other"
@@ -63,6 +70,8 @@
"""x.__getslice__(i, j) <==> x[i:j]
Use of negative indices is not supported.
+
+ Deprecated since Python 2.0 but still a part of UserList.
"""
class IExtendedReadSequence(IReadSequence):
@@ -80,20 +89,31 @@
"The write contract for a sequence that may enforce unique members"
def __setitem__(index, item):
- "x.__setitem__(index, item) <==> x[index]=item"
+ """x.__setitem__(index, item) <==> x[index]=item
+
+ Declaring this interface does not specify whether __setitem__
+ supports slice objects."""
def __delitem__(index):
- "x.__delitem__(index) <==> del x[index]"
+ """x.__delitem__(index) <==> del x[index]
+
+ Declaring this interface does not specify whether __delitem__
+ supports slice objects."""
def __setslice__(i, j, other):
"""x.__setslice__(i, j, other) <==> x[i:j]=other
- Use of negative indices is not supported."""
+ Use of negative indices is not supported.
+
+ Deprecated since Python 2.0 but still a part of UserList.
+ """
def __delslice__(i, j):
"""x.__delslice__(i, j) <==> del x[i:j]
Use of negative indices is not supported.
+
+ Deprecated since Python 2.0 but still a part of UserList.
"""
def __iadd__(y):
"x.__iadd__(y) <==> x+=y"
More information about the Zope3-Checkins
mailing list