*Memo:
- Python 3.14.0
- mypy 1.18.2
- mypy test.py
- Windows 11
An iterator is hashable as shown below:
print(hash(iter([0, 1, 2])))
# 127553071047
But assigning an iterator to the type hint collections.abc.Hashable gets the error as shown below even though an iterator is hashable:
from collections.abc import Hashable
v: Hashable = iter([0, 1, 2])
# Error
error: Incompatible types in assignment (expression has type "Iterator[int]", variable has type "Hashable")