Supported Python features
A list of unsupported Python features is maintained in the mypy wiki:
Runtime definition of methods and functions
By default, mypy will complain if you add a function to a classor module outside its definition – but only if this is visible to thetype checker. This only affects static checking, as mypy performs noadditional type checking at runtime. You can easily work aroundthis. For example, you can use dynamically typed code or values withAny
types, or you can use setattr()
or other introspectionfeatures. However, you need to be careful if you decide to do this. Ifused indiscriminately, you may have difficulty using static typingeffectively, since the type checker cannot see functions defined atruntime.