Akira Li <4kir4.1i@gmail.com> writes:
3. Cannot accept an iterator (goes through it twice, or permanently stores a reference to it, etc) neither
*iterable* is an object that you can pass to iter() to get *iterator*. An iterable does not guarantee that it yields the same items twice.
True or false?: It is reasonable to write algorithms that iterate twice over a passed-in iterable, with the expectation that said iterable will typically be an object (or a view of such an object) which will not be concurrently modified (e.g. by a different thread or by a side-effect of a callback) during the execution of the algorithm, but which does not behave in a useful way when given an iterator, a generator, or any other kind of iterable which exhibits similar behavior whereby the second and further attempts to iterate will yield no items.