Jason Orendorff (2014-10-06T18:43:53.000Z)
On Mon, Oct 6, 2014 at 1:34 PM, Domenic Denicola
<domenic at domenicdenicola.com> wrote:
> This is iterables vs. iterators IMO. Iterators are inherently stateful and I'd expect anything that uses them to consume them, even something named "map". Iterables of course would not be.

I agree. It's inherent in the python-like design we're using for iteration.

It is not so jarring in practice, even for people with the classical
training to recognize what a farce it is. :) Many uses of itertools in
python, though blatantly stateful in implementation and operation,
still "feel" functional, because the iterator being consumed is a
temporary, something like mydict.iterkeys(). The mutation isn't
observable if there's no other reference to the iterator object.

-j
forbes at lindesay.co.uk (2016-02-01T14:24:54.357Z)
I agree. It's inherent in the python-like design we're using for iteration.

It is not so jarring in practice, even for people with the classical
training to recognize what a farce it is. :) Many uses of itertools in
python, though blatantly stateful in implementation and operation,
still "feel" functional, because the iterator being consumed is a
temporary, something like mydict.iterkeys(). The mutation isn't
observable if there's no other reference to the iterator object.