collections-named-tuple (PYI024)
Added in v0.0.271 · Related issues · View source
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.
Inheriting from typing.NamedTuple creates a custom tuple subclass in
the same way as using the collections.namedtuple factory function.
However, using typing.NamedTuple allows you to provide a type annotation
for each field in the class. This means that type checkers will have more
information to work with, and will be able to analyze your code more
precisely.
Example
Use instead: