KEMBAR78
Allow calling TupleTypes if the fallback can be called by msullivan · Pull Request #4367 · python/mypy · GitHub
Skip to content

Conversation

@msullivan
Copy link
Collaborator

Fixes #4360

@gvanrossum
Copy link
Member

Would you consider adding a test where __call__ takes args and returns a relevant value? (Just being paranoid here.)

Copy link
Member

@ilevkivskyi ilevkivskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the right fix, but could you please add more tests:

  • With classes inheriting normal tuple instead of named tuple
  • With forward references (where classes are defined after the call)
  • With more complex __call__ methods and reveal_type.

@msullivan
Copy link
Collaborator Author

Added more testing. Our documentation claims that Tuple can't be subclassed directly, which is why I was testing with NamedTuple.

@ilevkivskyi
Copy link
Member

Added more testing. Our documentation claims that Tuple can't be subclassed directly, which is why I was testing with NamedTuple.

The docs need to be updated, would you like to make a PR?

@ilevkivskyi ilevkivskyi merged commit 080e345 into master Dec 16, 2017
@ilevkivskyi ilevkivskyi deleted the call-tuple branch December 16, 2017 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants