Hello,
2019-04-16 Stefano Borini <[email protected]> dixit:
> def g():
> yield 2
> yield 3
> return 6
[...]
> for x in g() return v:
> print(x)
>
> print(v) # prints 6
I like the idea -- occasionally (when dealing with `yield
from`-intensive code...) I wish such a shortcut existed.
I don't like the proposed keyword. Maybe `as` would be better?
for x in g() as v:
print(x)
print(v)
Cheers,
*j
_______________________________________________
Python-ideas mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/