Closed
Description
Sample:
class Some:
def __getitem__(self, i: int) -> str:
if i >= 2:
raise IndexError()
return chr(97 + i)
s = Some()
for x in s: # error here
print(x)
Output:
» mypy out/ex.py --strict-optional --warn-unreachable --show-traceback
out/ex.py:10: error: "Some" has no attribute "__iter__" (not iterable)
But, in runtime it works just fine:
» python out/ex.py
a
b
I will try to send a PR soon!