Why this article?

What is mypy?

What is a good resource for me to study type hinting?

Type hinting cheatsheet

Awesome live coding from [3]

How to use NamedTuple

from typing import NamedTuple

class Point(NamedTuple):
x: int
y: int = 1 # Set default value

Point(3) # -> Point(x=3, y=1)
>>> from collections import namedtuple>>> Point = namedtuple('Point', 'x y')>>> pt1 = Point(1.0, 5.0)>>> pt2 = Point(2.5, 1.5)>>> pt1Point(x=1.0, y=5.0)>>> pt1.x1.0>>> pt1[0]1.0

Put quotes around the type or not

Difference between Optional and Union

Callable

How to run mypy to ignore missing imports

mypy autograd/ --ignore-missing-imports

Reference

Data Scientist/MLE/SWE @takemobi