Iterators: Would "rewind" be a good idea?

Edward Elliott nobody at 127.0.0.1
Sun May 21 18:19:30 EDT 2006


Roy Smith wrote:

> Edward Elliott <nobody at 127.0.0.1> wrote:
>> This is why the C++ STL has independent forward and backward iterator
>> types.
> 
> Let me see if I can paraphrase the difference between the Python design
> philosophy and the C++ design philosophy about most things.  Python says,
> "Let's make things simple enough that it can be explained fully in a
> couple of paragraphs, even if it means there are some things you can't
> do".  C++ says, "Let's make it possible to do anything, even if it makes
> it complicated enough that it takes a shelf full of books to explain it
> all". 

STL has its problems, complexity among them, but just because it's in the
STL doesn't automatically make it a bad idea.  They faced a similar
problem, and this is how some very smart people solved it.  There's always
value in exploring that.

It doesn't get much simpler than adding one method (prev) with symmetry to
an existing method (next).

 
> There may be value in restartable iterators, but comparing what we've got
> now to STL isn't the way to convince people it's a good idea :-)

BTW I never said backwards iterators were a good idea.  I haven't decided
yet.

-- 
Edward Elliott
UC Berkeley School of Law (Boalt Hall)
complangpython at eddeye dot net



More information about the Python-list mailing list