-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
If I run mypy against the following code:
from typing import Callable, Union
SomeFieldType = Union[str, Callable[[str], int]]
class SomeClass(object):
def __init__(self, some_field: SomeFieldType) -> None:
self.some_field = some_field
def do_something(self) -> None:
if callable(self.some_field):
self.some_field('foobar')
it complains about self.some_field not being callable:
test_mypy.py: note: In member "do_something" of class "SomeClass":
test_mypy.py:11: error: "str" not callable
Perhaps mypy could be made aware of the "callable(...)" statements? Thanks!