[Python-Dev] Single- vs. Multi-pass iterability
David Abrahams
David Abrahams" <david.abrahams@rcn.com
Wed, 17 Jul 2002 09:48:19 -0400
From: "Barry A. Warsaw" <barry@zope.com>
> CC> I don't think it is too late. 90% ++ of the python code base
> CC> out there doesn't use iterators yet... people are still
> CC> wrapping their minds around it to see how they can use it in
> CC> their applications. If it was publicly stated that this could
> CC> be "fixed" in the next version I don't think that it would
> CC> hurt. These things happen, and sometimes its best to "roll
> CC> back". Programmers understand this.
>
> And besides (to continue Clark's devils advocacy), how much of the
> code out there that /does/ use iterators, calls .next() explicitly?
Hmm, I'm getting excited! We rarely get an opportunity to fix mistakes in
language design.
Probably someone will bring me back to reality shortly, though ;-)
Maybe I'll do it: the problem is really the iterators people have written.
However, you could implicitly generate __next__() which calls next() when
the result of __iter__() lacks a __next__() function... with a warning, of
course.
-Dave