[issue32856] Optimize the `for y in [x]` idiom in comprehensions

Raymond Hettinger report at bugs.python.org
Tue Oct 15 20:53:33 EDT 2019


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

> I just discovered that the assignment operator leaks variables
> out of comprehensions.
> ...
> So it does not supersedes this optimization.

That's a real bummer.  IIRC, it was discussion of this proposal that motivated the creation of the walrus operator.

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32856>
_______________________________________


More information about the Python-bugs-list mailing list