On Tue, Mar 17, 2009 at 12:24 PM, Andre Engels <andreeng...@gmail.com> wrote: > On Tue, Mar 17, 2009 at 12:12 PM, Anjanesh Lekshminarayanan > <m...@anjanesh.net> wrote: >>>>> a = ['cat','dog','elephant'] >>>>> a.next() >> Traceback (most recent call last): >> File "<stdin>", line 1, in <module> >> AttributeError: 'list' object has no attribute 'next' >>>>> >> Is there something that imtates PHP's next() ? (http://php.net/next) > >>>> b = a.__iter__() >>>> b.next() > 1 >>>> b.next() > 2
That should of course be: >>> b = a.__iter__() >>> b.next() 'cat' >>> b.next() 'dog' I had copied a bit too literal from my own attempt... -- André Engels, andreeng...@gmail.com -- http://mail.python.org/mailman/listinfo/python-list