On Thu, Oct 1, 2015 at 8:10 AM, Steven D'Aprano <email@example.com> wrote:
is a *general* distinction between two cases:
- iterables which are iterators
- iterables which are not iterators
We have a name for the first set: "iterators". But we don't have a name
for the second set. Andrew suggested "non-iterator iterables" is too
clumsy for general use, and suggests we need a better name. You
suggested "iterables", but that clearly cannot work, since iterators are
a kind of iterable.
sure -- but I've lost track of why it matters. "iterator" is well defined. And so is "iterable" -- why do we need to care whether the iterable returns itself when asked for an iterator?
the term "sequence" is useful -- it defines certain behavior. So is the term "iterable", for the same reason.
And it would be useful to say that given object is both a sequence and an iterable (are sequences iterable by definition?)
But if why do you need to know that something is an iterable, but NOT an iterator? isn't that an implementation detail?