[Python-Dev] bool(iter()) changed between 2.3 and 2.4
Guido van Rossum
guido at python.org
Thu Sep 22 05:14:12 CEST 2005
On 9/21/05, Raymond Hettinger <raymond.hettinger at verizon.net> wrote:
> [Guido van Rossum]
> > Could you at least admit that this was an oversight and not try to
> > pretend it was intentional breakage?
> Absolutely. I completely missed this one.
Thanks; spoken like a man.
I strongly feel that this needs to be corrected in 2.5. Iterators
should have neither __len__ nor __nonzero__. I see mostly agreement
that this is a misfeature. We don't really want to start writing code
x = it.next()
when we can already write it like this:
for x in it:
Keeping a special API to allow a more efficient implementation of
__reversed__ is fine.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev