[Python-3000] rename it.next() to it.__next__(), add a next() built-in
Terry Reedy
tjreedy at udel.edu
Tue Mar 6 02:37:33 CET 2007
"Greg Ewing" <greg.ewing at canterbury.ac.nz> wrote in message
news:45ECA6CA.6010309 at canterbury.ac.nz...
| Terry Reedy wrote:
|
| > One of the virtues, and as I recall, design purposes, of .next calls is
to
| > be fast. After the first call, execution jumps directly into the
| > pre-existing stack frame.
|
| You're thinking of generators,
I noticed after sending
| > It is then fairly
| > standard to factor out the attribute lookup with with 'xnext = x.next'
|
| You could still do xnext = x.__next__ if you wanted.
Of course. And one of my points is that the translater must make this
translation, which seems not to be in the current proposal, to avoid
breaking code. The other is that this idiom makes the use cases for a
builtin rather rare.
tjr
More information about the Python-3000
mailing list