[Python-ideas] Reuse "for" to express "given"
Serhiy Storchaka
storchaka at gmail.com
Thu May 24 12:43:20 EDT 2018
24.05.18 18:54, Alexander Belopolsky пише:
> I have read most of the PEP 572 related threads, but I don't think I've
> seen this idea. As many other people mentioned, Python already allows a
> trick to introduce local bindings in generator expressions and list
> comprehensions. This can be achieved by adding a "for var in [<expr>]"
> clause. I propose to make "for var = <expr>" have the same effect
> as "for var in [<expr>]".
It was discussed before (at least in the context of comprehensions), and
was rejected because in some other popular languages `for var = <expr>`
is the same as `for var in <expr>` in Python.
More information about the Python-ideas
mailing list