Skip to content

error for using collections.namedtuple #11304

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Akuli opened this issue Oct 9, 2021 · 4 comments
Closed

error for using collections.namedtuple #11304

Akuli opened this issue Oct 9, 2021 · 4 comments
Labels

Comments

@Akuli
Copy link
Contributor

Akuli commented Oct 9, 2021

Feature

error for using collections.namedtuple

Pitch

if you use collections.namedtuple, you get implicitly Any types everywhere

@Akuli Akuli added the feature label Oct 9, 2021
@sobolevn
Copy link
Member

sobolevn commented Oct 9, 2021

Why? It is valid python. And it very widely used for older versions / cross-version compat. For example, in psutil.

Related #11206

@Akuli
Copy link
Contributor Author

Akuli commented Oct 9, 2021

It is not suitable for all projects, and shouldn't be enabled by default, maybe not even with --strict. But I would use it in new code.

@emmatyping
Copy link
Member

I think this is something you could make a flake8 lint for, or if you prefer a mypy plugin, but we won't be adding this, as it isn't really part of the goals of mypy.

@Akuli
Copy link
Contributor Author

Akuli commented Oct 9, 2021

Yeah, I was about to comment that I realized it is more of a linter thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants