[EMAIL PROTECTED] wrote:
Is there a reason why generators have a special method named "next" vs.
"__next__"?

All other Python's special names have the double underscore
prefix/suffix.
http://docs.python.org/ref/specialnames.html

It's actually considered a mistake.

The original rationale is spelled out in PEP 234 - see the Resolved Issues section:
http://www.python.org/dev/peps/pep-0234/

It is being renamed to __next__() in Python 3.0 and there will be a builtin next() method that calls it. Instead of iterator.next() you will call next(iterator).
http://www.python.org/dev/peps/pep-3114/

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to