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




--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to