2009/6/21 Terry Reedy firstname.lastname@example.org:
Nick Coghlan wrote:
- I've never seen a function parameter spec'ed as iterable vs
reiterable. It's always iterable vs sequence.
The latter could be over-spec'ed because people are used to that being the choice, or because 'sequence' is being used as a synonym for 'reiterable' even though it implies more than is needed.
OTOH, it could be because "reiterable" isn't a commonly used concept in Python. It's not entirely clear to me why this is, maybe it's because it's not actually that useful, maybe it's because it's hard to define clearly, or maybe there's another reason.
But to some extent this whole thread has the same sort of "solution looking for a problem" feel that earlier threads about reiterability have had.
FWIW, the difference between iterators and reiterables is similar to that between C++ input iterators and forward iterators. So it may be worth looking to that in the quest for use cases. However, itertools.tee may cover a number of cases that would need a forward iterator in C++.