[Python-Dev] Adding start to enumerate()
Guido van Rossum
guido at python.org
Wed May 14 00:18:44 CEST 2008
On Tue, May 13, 2008 at 3:11 PM, Steven D'Aprano <steve at pearwood.info> wrote:
> With iterators being such a fundamental part of Python these days,
> perhaps one day we'll see the functions in the itertools module become
> iterator methods, as happened with strings. But that's a discussion for
> another day.
Unlikely. Every method needs to be reimplemented for each type that is
expected to support it. There are only two string types, so that's
manageable. But there are many dozens of iterator types. Insisting on
a common base class would be unpythonic. Plus, the functional approach
makes it possible to treat various non-iterators (like sequences and
other iterables) the same way.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list