[Python-Dev] Single- vs. Multi-pass iterability

Andrew Koenig ark@research.att.com
Fri, 12 Jul 2002 13:02:15 -0400 (EDT)


>>>>>> "AK" == Andrew Koenig <ark@research.att.com> writes:

Barry> Would it be useful to add to the interator "interface" a
Barry> method which would retrieve the original iterable object?

AK> What if there isn't one?

Barry> The method would return None.

But then you can't rely on it.  That is, if you want to write code
that depends on the ability to retrieve the original iterable,
you have to give up the ability for that code to work on
generators, for example.

I'm not saying it's not a useful thing to have; I'm just saying
it might not be as useful as it appears at first.