Converting generator expression to list comprehension in Python #430
-
Hi, I have a following rule:
The rule fix converts |
Beta Was this translation helpful? Give feedback.
Answered by
HerringtonDarkholme
May 30, 2023
Replies: 2 comments 15 replies
-
Looks like it is impossible to do it here... I think it might need string manipulation to make it work. Reference: #315 |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
q0w
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like it is impossible to do it here...
Python generator is very unique in that parentheses are shared by the generator_expression and call expression.
And it is impossible to make a contextual pattern because
($$$A)
is not interpreted as a generator expression.I think it might need string manipulation to make it work.
Reference: #315