array next pointer
Luis Zarrabeitia
kyrie at uh.cu
Tue Mar 17 09:40:28 EDT 2009
Quoting andrew cooke <andrew at acooke.org>:
> Andre Engels wrote:
> [...]
> >>>> b = a.__iter__()
>
> not sure from what version, but certainly in 2.6 and on, you can improve
> the syntax slightly:
> >>> b = iter(a)
> >>> b.next()
Indeed. Directly calling __special_methods__ should be avoided. That one is a
better idiom.
Works for python2.4 and 2.5 also.
In python3, this should be used instead:
>>> b = iter(a)
>>> c = next(b)
(btw, I love the new sentinel argument for the next function in python3!)
--
Luis Zarrabeitia
Facultad de Matemática y Computación, UH
http://profesores.matcom.uh.cu/~kyrie
Participe en Universidad 2010, del 8 al 12 de febrero de 2010
La Habana, Cuba
http://www.universidad2010.cu
More information about the Python-list
mailing list