Python Negatypes
Back in 2007 Python added Abstract Base Classes, which were intended to be used as interfaces:
fromabc import ABC classAbstractIterable(ABC): @abstractmethod def__iter__(self): while False: yield None defget_iterator(self): return self.__iter__() ABCs were added to strengthen the duck typing a little. If you inherited AbstractIterable, then everybody knew you had an implemented __iter__ method, and could handle that appropriately.
Unsurprisingly, this idea never caught on. People instead prefered “better ask forgiveness than permission” and wrapped calls to __iter__ in a try block.