NamedTuple

suggest change

Creating a namedtuple with type hints is done using the function NamedTuple from the typing module:

import typing
Point = typing.NamedTuple('Point', [('x', int), ('y', int)])

Note that the name of the resulting type is the first argument to the function, but it should be assigned to a variable with the same name to ease the work of type checkers.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents