[Python-3000] PEP: rename it.next() to it.__next__(), add a next() built-in

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Mar 5 23:16:08 CET 2007


Barry Warsaw wrote:

> OTOH, making iterators callable as equivalent to .next() as I think  
> Raymond suggested sounds about perfect.  You get __next__(), plus  
> explicit iteration with no additional built in necessary.

But that would raise the question of why __next__
wasn't called __call__ instead.

Also I'm not sure I like this idea. It smells like
an abuse of the notion of calling to me. One doesn't
normally expect that calling a callable object has
a side effect on the callable itself.

--
Greg


More information about the Python-3000 mailing list