[Python-3000] PEP: rename it.next() to it.__next__(), add a next() built-in
jcarlson at uci.edu
Tue Mar 6 21:05:13 CET 2007
"Guido van Rossum" <guido at python.org> wrote:
> Having now read this entire thread I am going to accept Ping's PEP.
> Adding the sentinel argument to the next() builtin was what did it for
> me: it neatly solves the problem if having to catch that StopIteration
> in 99% of the cases.
Have you read the post by Thomas Wouters in regards to .next() vs.
.__next__() ? The idea is that methods that *shouldn't* be called
from user code explicitly have generally received __magic__ methods,
while methods that have uses-cases for being called directly get
He (and I believe most everyone) is in favor of some two-argument
builtin or otherwise named next(interator, default=), it's the bulk
renaming of .next -> .__next__ that is the real point of contention
(with non-iterator .next methods, .next instance variables, etc.)
More information about the Python-3000