Steven D'Aprano email@example.com writes: ...
You've got the idea: the word *iterable* may be used in the context when not all iterables are accepted.
Sure. But the distinction is that while there are a whole lot of different iterables:
- iterables with a sufficiently small number of items
- iterables of hashable items
- iterables of (hashable key, item) pairs
- iterables of prime numbers less than one million
- iterables of strings containing exactly 1 vowel
etc they are special cases and don't need specialised names. 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.
I meant that you won't use the word *iterable* if your function accepts _only_ iterators and therefore if I see *iterable" I expect that the function can handle arbitrary iterables, not just iterators.
If your function rejects iterators then in practice it means that you might want a re-iterable/re-runnable (that I see mentioned in the thread) iterable (not an arbitrary "non-iterator iterable").
If there is no restriction that the same items should be produced the second time ("rerunnable iterable"?) then *collection" (introduced at the top of the thread) may work. Though *collection* implies that an iterable can't return the same (non-self) iterator -- otherwise an iterator is also a collection.
I still don't see a practical need to avoid the word "iterable" unless new requirements (in addition to being non-iterator) are present.