Type Hints/Annotations

Type hints/annotations for Python are introduced in PEP 484 and PEP 526. The python interpreter completely ignores type hints/annotations, it is type syntax which is formalized so that third-party tools such as IDEs or type checkers such as MyPy can then use it to provide type checking and other useful type inference capabilities.

The JetBrains range of IDEs support these type hints (e.g. PyCharm, IntelliJ IDEA).

Basic Types

There is also None, which is commonly used to define the return type of a function that doesn’t return anything.

Lists, Dicts, e.t.c


When a variable is optional, use Optional.

If you want to ignore any type checking:


Posted: August 21st, 2018 at 11:31 am
Last Updated on: August 21st, 2018 at 12:42 pm