Dong-hee Na <[email protected]> added the comment:
Dear core developers,
I 'd like to discuss fixing this issue.
IMHO, There are 2 options to fix this issue.
1. Add parenthesize when creating ListComp.
The change will be as follow:
new = ListComp(results.get("fp").clone(),
results.get("fp").clone(),
results.get("it").clone(),
- results.get("xp").clone())
+ parenthesize(results.get("xp").clone()))
But generated codes are not pretty.
2. Transform the lambda function as same as a normal function.
The only needed is removing lambda specific logics on fixer.
The generated code will be like this in this case.
x = filter(lambda x: True if x > 2 else False, data)
x = list(filter(lambda x: True if x > 2 else False, data))
Personally, I prefer the 2nd option because it's more clear.
If the proposal is accepted, I 'd like to fix this issue.
If there are any ideas, please let me know.
Thank you always!
----------
nosy: +benjamin.peterson
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue38871>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com