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

Implement nested list comprehensions #11

Closed
JukkaL opened this issue Dec 11, 2012 · 6 comments
Closed

Implement nested list comprehensions #11

JukkaL opened this issue Dec 11, 2012 · 6 comments
Labels

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Dec 11, 2012

Nested list comprehensions are not accepted by the parser. Example:

print([(x, y) for x in range(5) for y in range(3)])
@etrepum
Copy link
Contributor

etrepum commented Jul 23, 2014

It seems like the representation here should change to be more similar to how it is in Python's AST

expr = …
         | ListComp(expr elt, comprehension* generators)
         | SetComp(expr elt, comprehension* generators)
         | DictComp(expr key, expr value, comprehension* generators)
         | GeneratorExp(expr elt, comprehension* generators)
         | …

comprehension = (expr target, expr iter, expr* ifs)

@etrepum
Copy link
Contributor

etrepum commented Jul 23, 2014

An additional bug here is that only at most one if is allowed

@JukkaL
Copy link
Collaborator Author

JukkaL commented Jul 25, 2014

See this commit by Eric Price: d3ce840

@etrepum
Copy link
Contributor

etrepum commented Jul 25, 2014

Ah, didn't realize there was work happening on a branch. I don't think this fixes #324 but might have a conflict. Is this getting merged any time soon? I can rebase when that happens.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Jul 25, 2014

I'm probably going to merge the branch later today, assuming I don't find any critical bugs. I'll write a comment when it happens.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Jul 25, 2014

This was just merged. Closing the issue.

@JukkaL JukkaL closed this as completed Jul 25, 2014
etrepum added a commit to etrepum/mypy that referenced this issue Jul 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants