Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 74b6495

Browse files
committed
Merge r60679
1 parent 77c02eb commit 74b6495

1 file changed

Lines changed: 4 additions & 30 deletions

File tree

Lib/_abcoll.py

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def __subclasshook__(cls, C):
8282
return NotImplemented
8383

8484

85-
class Iterator(metaclass=ABCMeta):
85+
class Iterator(Iterable):
8686

8787
@abstractmethod
8888
def __next__(self):
@@ -157,7 +157,7 @@ def __subclasshook__(cls, C):
157157
### SETS ###
158158

159159

160-
class Set(metaclass=ABCMeta):
160+
class Set(Sized, Iterable, Container):
161161

162162
"""A set is a finite, iterable container.
163163
@@ -169,19 +169,6 @@ class Set(metaclass=ABCMeta):
169169
then the other operations will automatically follow suit.
170170
"""
171171

172-
@abstractmethod
173-
def __contains__(self, value):
174-
return False
175-
176-
@abstractmethod
177-
def __iter__(self):
178-
while False:
179-
yield None
180-
181-
@abstractmethod
182-
def __len__(self):
183-
return 0
184-
185172
def __le__(self, other):
186173
if not isinstance(other, Set):
187174
return NotImplemented
@@ -358,7 +345,7 @@ def __isub__(self, it: Iterable):
358345
### MAPPINGS ###
359346

360347

361-
class Mapping(metaclass=ABCMeta):
348+
class Mapping(Sized, Iterable, Container):
362349

363350
@abstractmethod
364351
def __getitem__(self, key):
@@ -378,15 +365,6 @@ def __contains__(self, key):
378365
else:
379366
return True
380367

381-
@abstractmethod
382-
def __len__(self):
383-
return 0
384-
385-
@abstractmethod
386-
def __iter__(self):
387-
while False:
388-
yield None
389-
390368
def keys(self):
391369
return KeysView(self)
392370

@@ -523,7 +501,7 @@ def setdefault(self, key, default=None):
523501
### SEQUENCES ###
524502

525503

526-
class Sequence(metaclass=ABCMeta):
504+
class Sequence(Sized, Iterable, Container):
527505

528506
"""All the operations on a read-only sequence.
529507
@@ -535,10 +513,6 @@ class Sequence(metaclass=ABCMeta):
535513
def __getitem__(self, index):
536514
raise IndexError
537515

538-
@abstractmethod
539-
def __len__(self):
540-
return 0
541-
542516
def __iter__(self):
543517
i = 0
544518
try:

0 commit comments

Comments
 (0)