Type Hint for namedtuple
Recipes
typing.NamedTuple
is the typed version of collections.namedtuple()
.
from typing import NamedTuple
class Point(NamedTuple):
x: float
y: float
This is equivalent to:
from collections import namedtuple
Point = namedtuple('Point', ['x', 'y'])