User talk:WillNess: Difference between revisions

Content added Content deleted
(citing docs)
mNo edit summary
Line 16: Line 16:
return tuple(gen(d) for d in deques)
return tuple(gen(d) for d in deques)
</lang>
</lang>
:I read it to show that each iterator produced by <code>tee()</code> holds on to its own dequeue (list with pop() and append()). When a new item is needed from the underlying generator, it is appended separately into each one of the dequeues. Were they all to share one dequeue amongst themselves, that would be a shared storage. <code>popleft()</code> wouldn't be always called, but only when the ''leftmost'' of internal iterators pointing into internal list would get advanced. [[User:WillNess|WillNess]] 10:53, 9 September 2011 (UTC)
:I read it to show that each iterator produced by <code>tee()</code> holds on to its own dequeue (list with pop() and append()). When a new item is needed from the original iterable, it is appended separately into each one of the dequeues. Were they all to share one dequeue amongst themselves, that would be a shared storage. <code>popleft()</code> wouldn't be always called, but only when the ''leftmost'' of internal iterators pointing into internal list would get advanced. [[User:WillNess|WillNess]] 10:53, 9 September 2011 (UTC)