RE: [Python-Dev] Single- vs. Multi-pass iterability

July 14, 2002
3:46 p.m.
Definitely not reliable - it will fail for a file object ... (even with the changes currently going in). What would be more reliable (but still not infallible) would be: if iter(x) == iter(x): # this is *definitely* a single-pass iterable All iterators are by definition single-pass iterables, and with the changes being made to the file object, the above code would work for all builtin iterable types as well. Tim Delaney
8283
Age (days ago)
8283
Last active (days ago)
0 comments
1 participants
participants (1)
-
Delaney, Timothy