array next pointer

andrew cooke andrew at acooke.org
Tue Mar 17 07:37:38 EDT 2009


Andre Engels wrote:
[...]
>>>> b = a.__iter__()
>>>> b.next()
> 'cat'
>>>> b.next()
> 'dog'

NOTE CORRECTION BELOW!  IT'S next(b), not b.next() which doesn't exist in
Python 3 (if you need it, it's now b.__next__()).  sorry.

not sure from what version, but certainly in 2.6 and on, you can improve
the syntax slightly:

>>> b = iter(a)
>>> next(b)

andrew







More information about the Python-list mailing list