Vladimir

58%
Flag icon
the best way to check if an object x is an iterator is to call isinstance(x, abc.Iterator). Thanks to Iterator.__subclasshook__, this test works even if the class of x is not a real or virtual subclass of Iterator.
Fluent Python: Clear, Concise, and Effective Programming
Rate this book
Clear rating
Open Preview