Closed
Description
Running this code:
from typing import Any, Callable
class Foo:
def __init__(self, a: int) -> None:
print(a)
def bar(f: Callable[[Any], Any]) -> None:
if type(f) ==Foo:
print("The same!")
f(3)
bar(Foo)
with mypy 0.942 and "strict_equality" enabled leads to:
error: Non-overlapping equality check (left operand type: "Type[Callable[[Any], Any]]", right operand type: "Type[Foo]")
I think this is wrong, as clearly, mypy accepts Foo
as a correct argument to bar
, in which case checking if f
inside the function is of type Foo
should also be valid...