Python 2.6 introduced a next function.
Why was this necessary? One could always type obj.next() instead of next(obj).
Is the latter more pythonic?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
PEP 3114 describes this change. An excerpt about the motivation:
Be sure to read this PEP for more interesting details.
As for why you want to use the
nextbuilt-in: one good reason is that thenextmethod disappears in Python 3, so for portability it’s better to start using thenextbuilt-in as soon as possible.