collections-named-tuple (PYI024)#
Derived from the flake8-pyi linter.
What it does#
Checks for uses of collections.namedtuple
in stub files.
Why is this bad?#
typing.NamedTuple
is the "typed version" of collections.namedtuple
.
The class generated by subclassing typing.NamedTuple
is equivalent to
collections.namedtuple
, with the exception that typing.NamedTuple
includes an __annotations__
attribute, which allows type checkers to
infer the types of the fields.
Example#
Use instead: