summaryrefslogtreecommitdiffstats
path: root/Lib/_abcoll.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2008-02-09 02:53:48 (GMT)
committerRaymond Hettinger <python@rcn.com>2008-02-09 02:53:48 (GMT)
commit74b6495b344303a84bf5e51ff388d8200dad4f64 (patch)
treea5a3918457cd6964ba84639f1f46adc8ab455f9c /Lib/_abcoll.py
parent77c02ebf3821c381883c9bc2675bafddbe0fff09 (diff)
downloadcpython-74b6495b344303a84bf5e51ff388d8200dad4f64.zip
cpython-74b6495b344303a84bf5e51ff388d8200dad4f64.tar.gz
cpython-74b6495b344303a84bf5e51ff388d8200dad4f64.tar.bz2
Merge r60679
Diffstat (limited to 'Lib/_abcoll.py')
-rw-r--r--Lib/_abcoll.py34
1 files changed, 4 insertions, 30 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py
index 327b223..113507a 100644
--- a/Lib/_abcoll.py
+++ b/Lib/_abcoll.py
@@ -82,7 +82,7 @@ class Iterable(metaclass=ABCMeta):
return NotImplemented
-class Iterator(metaclass=ABCMeta):
+class Iterator(Iterable):
@abstractmethod
def __next__(self):
@@ -157,7 +157,7 @@ class Callable(metaclass=ABCMeta):
### SETS ###
-class Set(metaclass=ABCMeta):
+class Set(Sized, Iterable, Container):
"""A set is a finite, iterable container.
@@ -169,19 +169,6 @@ class Set(metaclass=ABCMeta):
then the other operations will automatically follow suit.
"""
- @abstractmethod
- def __contains__(self, value):
- return False
-
- @abstractmethod
- def __iter__(self):
- while False:
- yield None
-
- @abstractmethod
- def __len__(self):
- return 0
-
def __le__(self, other):
if not isinstance(other, Set):
return NotImplemented
@@ -358,7 +345,7 @@ MutableSet.register(set)
### MAPPINGS ###
-class Mapping(metaclass=ABCMeta):
+class Mapping(Sized, Iterable, Container):
@abstractmethod
def __getitem__(self, key):
@@ -378,15 +365,6 @@ class Mapping(metaclass=ABCMeta):
else:
return True
- @abstractmethod
- def __len__(self):
- return 0
-
- @abstractmethod
- def __iter__(self):
- while False:
- yield None
-
def keys(self):
return KeysView(self)
@@ -523,7 +501,7 @@ MutableMapping.register(dict)
### SEQUENCES ###
-class Sequence(metaclass=ABCMeta):
+class Sequence(Sized, Iterable, Container):
"""All the operations on a read-only sequence.
@@ -535,10 +513,6 @@ class Sequence(metaclass=ABCMeta):
def __getitem__(self, index):
raise IndexError
- @abstractmethod
- def __len__(self):
- return 0
-
def __iter__(self):
i = 0
try: