list 和 islice 对象都是可迭代的,但为什么会出现这种差异。
r = [1, 2, 3, 4]
i1, i2 = tee(r)
print [e for e in r if e < 3]
print [e for e in i2]
#[1, 2]
#[1, 2, 3, 4]
r = islice(count(), 1, 5)
i1, i2 = tee(r)
print [e for e in r if e < 3]
print [e for e in i2]
#[1, 2]
#[]