just out of curiosity I wanted to ask, why is the following wanted behavior in Python?
Suppose we have:
a = [1,2,3]
b = [1,2,3]
c = [1,2,3,4]
ai = iter(a)
bi = iter(b)
ci = iter(c)
Now, I expected the following example to print [4]
, however, it prints []
.
for _ in zip(ci, zip(ai, bi)):
pass
print(list(ci))
Console:
>>> print(list(ci))
[]
But when I change arguments of the outter zip, it prints what I expect ([4]
).
for _ in zip(zip(ai, bi), ci):
pass
print(list(ci))
Console:
>>> print(list(ci))
[4]
Shouldn't both example print the same result? Thanks.