[Python-ideas] Inline assignments using "given" clauses

Greg Ewing greg.ewing at canterbury.ac.nz
Mon May 14 10:07:04 EDT 2018


Steven D'Aprano wrote:
> To reiterate what Tim already pointed out, that original usecase 
> required a way to feed values *into* the comprehension.
> 
> https://mail.python.org/pipermail/python-ideas/2018-February/048971.html
> 
> There's no need for dedicated syntax for that if we can just set an 
> variable and have it show up in the comprehension.

Yes, but doing it that way also allows things to come *out*
of the comprehension, which is something we previously thought
was such a bad idea that we went to considerable lengths to
stop it happening. Now we seem to be seriously considering
going to further lengths to allow it again for *some* things.

Seems to me we should have a pretty compelling reason for
doing that. I don't feel very compelled by what I've seen
so far.

-- 
Greg


More information about the Python-ideas mailing list