Skip to content

Support isinstance with a tuple of types #947

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
JukkaL opened this issue Oct 17, 2015 · 1 comment
Closed

Support isinstance with a tuple of types #947

JukkaL opened this issue Oct 17, 2015 · 1 comment
Labels

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Oct 17, 2015

If the second argument to isinstance is a tuple, the inferred type for the first argument should be a union.

Example:

x = 1  # type: object
if isinstance(x, (int, str)):
    # type of x is Union[int, str] here    
    ...
@JukkaL
Copy link
Collaborator Author

JukkaL commented Jun 3, 2016

This works now.

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

1 participant