On 1 October 2015 at 19:41, Random832 firstname.lastname@example.org wrote:
On Thu, Oct 1, 2015, at 14:29, Chris Barker wrote:
But if why do you need to know that something is an iterable, but NOT an iterator? isn't that an implementation detail?
Because an iterator *cannot possibly* allow you to loop through the contents twice [either one after the other or in parallel], whereas *most* non-iterator iterables do allow this. This (among other things such as representing a well-defined finite bag of values) is the property we're really chasing, "non-iterator iterable" is just a clumsy and inaccurate way of saying it.
If I understand what you mean by "non-iterator iterable", then a long time ago, there was a similar discussion and the term "reiterable" was used (Google will probably find references). Nothing ever came of the discussion - if I recall, there was a lot of theoretical debate, but few practical use cases.
Anyone wanting to avoid a long, inconclusive discussion should probably chase up that old thread and see if anything new has been added this time around :-) Paul