CPython's implementation of collections.abc.Iterable has this bizarre idiom:
while False:
yield None
Seems like the second line will never be executed. So why not just use pass
instead?
The full code for the Iterable
class is as follows:
class Iterable(metaclass=ABCMeta):
__slots__ = ()
@abstractmethod
def __iter__(self):
while False:
yield None
@classmethod
def __subclasshook__(cls, C):
if cls is Iterable:
return _check_methods(C, "__iter__")
return NotImplemented
__class_getitem__ = classmethod(GenericAlias)