The type of the iterator


How can we know it is an iterator? We check it.

examples/iterators/simple_counter_type.py
from collections.abc import Iterator, Iterable
from counter import Counter

cnt = Counter()
print(cnt.__class__.__name__)
print(issubclass(cnt.__class__, Iterator))
print(issubclass(cnt.__class__, Iterable))

Counter
True
True