Add discussion about next() vs. __next__(). So far I'm liking next()

jut fine.
This commit is contained in:
Guido van Rossum 2001-04-23 20:04:59 +00:00
parent c0441481c9
commit 75110765c1
1 changed files with 7 additions and 0 deletions

View File

@ -97,6 +97,13 @@ C API Specification
reference to themselves; this is needed to make it possible to
use an iterator (as opposed to a sequence) in a for loop.
Discussion: should the next() method be renamed to __next__()?
Every other method corresponding to a tp_<something> slot has a
special name. On the other hand, this would suggest that there
should also be a primitive operation next(x) that would call
x.__next__(), and this just looks like adding complexity without
benefit. So I think it's better to stick with next().
Python API Specification