Skip to content

namedtuple syntax #32

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
srittau opened this issue Oct 23, 2019 · 2 comments · Fixed by #105
Closed

namedtuple syntax #32

srittau opened this issue Oct 23, 2019 · 2 comments · Fixed by #105

Comments

@srittau
Copy link
Member

srittau commented Oct 23, 2019

We could add a check for namedtuple syntax. Warn about collections.namedtuple in stubs, possibly also about using the non-class syntax.

@AlexWaygood
Copy link
Collaborator

#97 means that it is now illegal to import namedtuple from collections or do import collections; collections.namedtuple.

@JelleZijlstra, does #76 mean the non-class syntax for typing.NamedTuple is also now disallowed? If so, I think we're done here :)

@JelleZijlstra
Copy link
Collaborator

@JelleZijlstra, does #76 mean the non-class syntax for typing.NamedTuple is also now disallowed?

I don't think so, we allow assignments with call nodes on the RHS because there are various odd cases where they're needed. In particular, we have some non-class TypedDict definitions that use keys like "in", because the class version would be a SyntaxError.

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

Successfully merging a pull request may close this issue.

3 participants