On 01.10.2015 20:29, Chris Barker wrote:
On Thu, Oct 1, 2015 at 8:10 AM, Steven D'Aprano <email@example.com mailto:firstname.lastname@example.org> wrote:
But there 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?
You say some terms are useful because they define certain behavior.
I don't question this, but what I find questionable is the proliferation of all this equally-sounding and -feeling concepts. Your reaction supports that observation.