Skip to content
Advertisement

Tag: codata

Detecting cheapest way to build independent iterators

Suppose I’m writing a function taking in an iterable, and my function wants to be agnostic as to whether that iterable is actually an iterator yet or not. (This is a common situation, right? I think basically all the itertools functions are written this way. Take in an iterable, return an iterator.) If I call, for instance, itertools.tee(•, 2) on

Advertisement