bpo-32856: Optimize the assignment idiom in comprehensions. by serhiy-storchaka · Pull Request #16814 · python/cpython

Conversation

@serhiy-storchaka

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.

https://bugs.python.org/issue32856

Now `for y in [expr]` in comprehensions is so fast as a simple
assignment `y = expr`.

@serhiy-storchaka serhiy-storchaka changed the title Optimize assignment idiom in comprehensions bpo-32856: Optimize the assignment idiom in comprehensions.

Oct 15, 2019

scoder

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.

@scoder

Labels