◐ Shell
clean mode source ↗

Confusing __class__ for instance of non-generic class that subclasses generic class

The following program prints __main__.A[int] even though A is not generic. I'd expect it to print something like <class '__main__.A'>.

from typing import Iterator

class A(Iterator[int]):
    def __next__(self): pass

print(A().__class__)

Also, this does not generate an exception, even though A is not generic:

def f(x: A[int]) -> None: pass