| 1 |
Supported Python features |
| 2 |
========================= |
| 3 |
|
| 4 |
A list of unsupported Python features is maintained in the mypy wiki: |
| 5 |
|
| 6 |
- `Unsupported Python features <https://github.com/python/mypy/wiki/Unsupported-Python-Features>`_ |
| 7 |
|
| 8 |
Runtime definition of methods and functions |
| 9 |
******************************************* |
| 10 |
|
| 11 |
By default, mypy will complain if you add a function to a class |
| 12 |
or module outside its definition -- but only if this is visible to the |
| 13 |
type checker. This only affects static checking, as mypy performs no |
| 14 |
additional type checking at runtime. You can easily work around |
| 15 |
this. For example, you can use dynamically typed code or values with |
| 16 |
``Any`` types, or you can use :py:func:`setattr` or other introspection |
| 17 |
features. However, you need to be careful if you decide to do this. If |
| 18 |
used indiscriminately, you may have difficulty using static typing |
| 19 |
effectively, since the type checker cannot see functions defined at |
| 20 |
runtime. |