Le 20/12/2020 à 21:00, danilob a écrit :



b = ((x[0] for x in a))


There is a useless pair of parenthesis

b = (x[0] for x in a)

b is a GENERATOR expression

first list(b) calls next method on b repetedly until b is empty.
So it provides the "content" of b

second list(b) provides nothing since b is empty
(there is no reset on generators)




--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to