bpo-32856: Optimize the assignment idiom in comprehensions. by serhiy-storchaka · Pull Request #16814 · python/cpython
Conversation
Now for y in [expr] in comprehensions is so fast as a simple assignment y = expr.
Unlike to the := operator this idiom does not leak a variable to the outer scope.
serhiy-storchaka
changed the title
Optimize assignment idiom in comprehensions
bpo-32856: Optimize the assignment idiom in comprehensions.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have an opinion on the general feature, so just a few comments.
| ============= | ||
|
|
||
| * Optimized the idiom for assignment a temporary variable in comprehensions. | ||
| Now ``for y in [expr]`` in comprehensions is so fast as a simple assignment |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"as fast as" (also in news file)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thank you.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters