[Python-3000] Fwd: Re: rename it.next() to it.__next__(), add a next() built-in

Raymond Hettinger python at rcn.com
Tue Mar 6 00:35:14 CET 2007


[Greg Ewing]
>Invoking a builtin .next() method via a protocol
>function shouldn't be any slower than it is now.
>In both cases you've got one name lookup and one
>Python call, after which you go through the type
>slot directly to a C function.

Do you expect that next(someiterator) will be just
as fast and calling a boundmethod (such as:
counter=itertools.counter(1); counter())?


Raymond



>
>> 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.
>
>--
>Greg
>_______________________________________________
>Python-3000 mailing list
>Python-3000 at python.org
>http://mail.python.org/mailman/listinfo/python-3000
>Unsubscribe: http://mail.python.org/mailman/options/python-3000/python%40rcn.com


More information about the Python-3000 mailing list