[Python-ideas] PEP 572: Statement-Local Name Bindings
Serhiy Storchaka
storchaka at gmail.com
Wed Feb 28 09:32:39 EST 2018
28.02.18 16:14, Kirill Balunov пише:
> 2018-02-28 16:49 GMT+03:00 Serhiy Storchaka
> <storchaka at gmail.com
> <mailto:storchaka at gmail.com>>:
> Other options:
>
> stuff = [[y, y] for y in (f(x) for x in range(5))]
>
>
> Why not `stuff = [[y, y] for y in map(f, range(5))]`? It is currently
> the fastest and most readable version IMHO.
Only in this particular case. This doesn't work if the expression for
items depends on x or if the subexpression is not a function call.
More information about the Python-ideas
mailing list