News for hackers. Stuff that matters.
Re:Origins of Python's “Functional” Features (2009) by xapata on Monday January 09, 2017 @07:41AM (#13355908)
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.

Re:Origins of Python's “Functional” Features (2009) by Tulip68 on Monday January 09, 2017 @09:26AM (#13356473)
That is a very bad idea in general and will lead to enormous memory leaks when large tee'd iterators get out of sync with one another.

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...

Re:Origins of Python's “Functional” Features (2009) by xapata on Monday January 09, 2017 @09:40PM (#13362093)
Eh? I discouraged tee'ing iterators, or at least I thought I did.