[Python-3000] PEP: rename it.next() to it.next(), add a next() built-in (original) (raw)
Collin Winter collinw at gmail.com
Mon Mar 5 17:28:44 CET 2007
- Previous message: [Python-3000] PEP: rename it.next() to it.__next__(), add a next() built-in
- Next message: [Python-3000] PEP: rename it.next() to it.__next__(), add a next() built-in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 3/5/07, Ka-Ping Yee <python-dev at zesty.ca> wrote: [snip]
Transition Plan ===============
Two additional transformations will be added to the 2to3 translation tool [2]: * Method definitions named
next
will be renamed to_next_
. * Explicit calls to thenext
method will be replaced with calls to the built-innext
function. For example,x.next()
will becomenext(x)
. If the module being processed already contains a top-level function definition namednext
, the second transformation will not be done; instead, calls tox.next()
will be replaced withx._next_()
and a warning will be emitted.
The basic transformations for this are (relatively) easy to implement. Basing the second transformation on the absence of a top-level function definition (don't forget assignments and imports!) for "next", though, is going to require some surgery to 2to3's internals. I'll see what I can do.
Collin Winter
- Previous message: [Python-3000] PEP: rename it.next() to it.__next__(), add a next() built-in
- Next message: [Python-3000] PEP: rename it.next() to it.__next__(), add a next() built-in
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]