13 Oct
2016
13 Oct
'16
2:51 p.m.
On Thu, Oct 13, 2016, at 15:46, Random832 wrote:
so, under a similar 'transformation', "*foo for foo in bar" likewise becomes "def f(): for foo in bar: yield from foo"
bar = [(1, 2), (3, 4)] (*(1, 2), *(3, 4)) == == tuple(f()) [*(1, 2), *(3, 4)] == == list(f())
I accidentally hit ctrl-enter while copying and pasting, causing my message to go out while my example was less thorough than intended and containing syntax errors. It was intended to read as follows: ..."*foo for foo in bar" likewise becomes def f(): for foo in bar: yield from foo a, b = (1, 2), (3, 4) bar = [a, b] (*a, *b) == (1, 2, 3, 4) == tuple(f()) # tuple(*foo for foo in bar) [*a, *b] == [1, 2, 3, 4] == list(f()) # [*foo for foo in bar]