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

Ka-Ping Yee python-dev at zesty.ca
Tue Mar 6 00:03:48 CET 2007


On Mon, 5 Mar 2007, Josiah Carlson wrote:
> "Guido van Rossum" <guido at python.org> wrote:
> > On 3/5/07, Josiah Carlson <jcarlson at uci.edu> wrote:
> However, I have written methods named 'next' which have *nothing* to do
> with the iterator protocol.

This is exactly why the iterator protocol method should be named
__next__: so it can't collide with method names used for other purposes.

The translator will be imperfect, and probably will need some guidance
to do its work correctly.  But the problem you point out here is an
issue primarily with the language, not the translator, and Python 3.0
is a good opportunity for incompatible changes like this that will
future-proof the language.


-- ?!ng


More information about the Python-3000 mailing list