Skip to content

Support isinstance with a tuple of types #947

Closed

Description

@JukkaL

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    
    ...

Activity

  1. JukkaL commented on Jun 3, 2016

    @JukkaL
    CollaboratorAuthor

    This works now.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions