You can use reveal_type (expr) to ask mypy to display the inferred static type of an expression. In this case you should add an explicit Optional [.] type of a would be implicitly Any and need not be inferred), if type In particular, at least bound methods and unbound function objects should be treated differently. mypy cannot call function of unknown type - ASE untyped definitions and calls the following flags configure how mypy handles untyped function definitions or calls. Mypy follows PEP 484 semantics, which states that if a function's parameters are unannotated, they are assumed to have a type of Any, which represents a fully dynamic value of unknown type. All mypy does is check your type hints. (Regular function objects defined with def or lambda are descriptors that work this way, but builtin . This may be the case for third party packages, or occasionally for things in the standard library. (python.) As mypy is a static analyzer, or a lint-like tool, the type annotations are just hints for mypy and don't interfere when running your program. You run your program with a standard . The mypy command line - mypy 0.970+dev ... The actual mypy output is all nice and colourful This gave us even more information: the fact that we're using give_number in our code, which doesn't have a defined return type, so that piece of code also can have unintended issues.. TL;DR: for starters, use mypy --strict filename.py. --disallow-untyped-calls allows calling values with Any type #5968 (As discussed in the next section, you can override this . The problem seems to be that mypy disallows assigning to a method (which I think is reasonable) but thinks that a class variable declared with a Callable type (and initialized with a lambda) is also a method. If you sprinkle your code with type annotations, mypy can type check your code and find common bugs. Note Settings Reference for Python - Visual Studio Code The calls to f and ff below aren't rejected when using --disallow-untyped-calls, even though I believe that they should be: from typing import Any from non_existent import f # type: ignore # Not in the build def g (): pass def h () -> None : g ( asdf=1) # Error: Call to untyped function "g" in typed context f . mypy plugin — returns 0.19.0 documentation mypy cannot call function of unknown type - prohydraulic.com Can use variables like $ {workspaceFolder} and $ {workspaceFolder}/.venv. mypyやっていったぞ. Use normal rules for colons, that is, no space before and one space after a colon: text: str. Now the reveal_type on line 19 (which also applies to your loop).