return NotImplemented
-class Iterator(metaclass=ABCMeta):
+class Iterator(Iterable):
@abstractmethod
def __next__(self):
### SETS ###
-class Set(metaclass=ABCMeta):
+class Set(Sized, Iterable, Container):
"""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(metaclass=ABCMeta):
+class Mapping(Sized, Iterable, Container):
@abstractmethod
def __getitem__(self, key):
else:
return True
- @abstractmethod
- def __len__(self):
- return 0
-
- @abstractmethod
- def __iter__(self):
- while False:
- yield None
-
def keys(self):
return KeysView(self)
### SEQUENCES ###
-class Sequence(metaclass=ABCMeta):
+class Sequence(Sized, Iterable, Container):
"""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: