Iterable.register(str)
-class Iterator:
+class Iterator(Iterable):
__metaclass__ = ABCMeta
@abstractmethod
### SETS ###
-class Set:
+class Set(Sized, Iterable, Container):
__metaclass__ = ABCMeta
"""A set is a finite, iterable container.
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
### MAPPINGS ###
-class Mapping:
+class Mapping(Sized, Iterable, Container):
__metaclass__ = ABCMeta
@abstractmethod
else:
return True
- @abstractmethod
- def __len__(self):
- return 0
-
- @abstractmethod
- def __iter__(self):
- while False:
- yield None
-
def keys(self):
return KeysView(self)
def __ne__(self, other):
return not (self == other)
-class MappingView:
+class MappingView(Sized):
__metaclass__ = ABCMeta
def __init__(self, mapping):
### SEQUENCES ###
-class Sequence:
+class Sequence(Sized, Iterable, Container):
__metaclass__ = ABCMeta
"""All the operations on a read-only sequence.
def __getitem__(self, index):
raise IndexError
- @abstractmethod
- def __len__(self):
- return 0
-
def __iter__(self):
i = 0
try: