Make your functions consumers. Don't pass tee'd iterators in, but tee after receiving if necessary.
I don't see how find_first would cause any more problems than filter or sum.
I don't see how find_first would cause any more problems than filter or sum.
See here:
This itertool may require significant auxiliary storage (depending on how much temporary data needs to be stored). In general, if one iterator uses most or all of the data before another iterator starts, it is faster to use list() instead of tee().
https://docs.python.org/2/library/itertools.html#itertools.t...