Skip to content
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

Allow nonliteral tuple indexing #3514

Merged
merged 2 commits into from
Jun 9, 2017
Merged

Allow nonliteral tuple indexing #3514

merged 2 commits into from
Jun 9, 2017

Conversation

ddfisher
Copy link
Collaborator

@ddfisher ddfisher commented Jun 9, 2017

Fixes #899. Allows indexing and slicing tuples with nonliteral values: returns a Union of all tuple item types.

Copy link
Member

@gvanrossum gvanrossum left a comment

Choose a reason for hiding this comment

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

You can merge yourself after fixing up the indent (Curious why flake8 didn't catch this.)

def nonliteral_tuple_index_helper(self, left_type: TupleType, index: Expression) -> Type:
index_type = self.accept(index)
expected_type = UnionType.make_union([self.named_type('builtins.int'),
self.named_type('builtins.slice')])
Copy link
Member

Choose a reason for hiding this comment

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

Indent by one more space. (Was it vim or you that got this wrong?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops! That was me. I forgot to put the arguments in a list originally and failed to reindent after doing so.

Thanks for catching this!

@ilevkivskyi ilevkivskyi merged commit 9941b61 into master Jun 9, 2017
@ilevkivskyi ilevkivskyi deleted the nonliteral-tuple-index branch June 9, 2017 06:34
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