[Python-Dev] Single- vs. Multi-pass iterability
Guido van Rossum
guido@python.org
Thu, 11 Jul 2002 20:43:57 -0400
> The real reason to be able to introspect is so that you can handle both
> kinds.
> Even if you're willing to destroy the data by examining it, if you know you
> have a single-pass sequence, you might need to copy its elements into a
> multi-pass sequence (e.g. file.lines()) in order to get your work done.
Hm. I think it's just as good to make it the responsibility of the
caller to pass a multi-iterable. There could be a standard tool that
takes a single-iterable and produces a multi-iterable.
--Guido van Rossum (home page: http://www.python.org/~guido/)