Hi Franklin,
Thanks. I should have tested with a larger sequence.
I suppose delaying deletion by a bounded amount of objects is fine.
I was concerned that a potentially unbounded amount of objects was kept.
The "reference implementation" in the docs suggested that and my initial
testing seemed t
On Fri, May 26, 2017 at 2:45 PM, Stephan Houben wrote:
> Hi all,
>
> The itertools.tee function can hold on to objects "unnecessarily".
> In particular, if you do
>
> iter2 = itertools.tee(iter1, 2)[0]
>
> i.e. you "leak" one of the returned iterators, then all returned
> objects are not collected
Hi all,
The itertools.tee function can hold on to objects "unnecessarily".
In particular, if you do
iter2 = itertools.tee(iter1, 2)[0]
i.e. you "leak" one of the returned iterators, then all returned
objects are not collected until also iter2 is collected.
I propose a different implementation,