A question about class as an iterator

Yaşar Arabacı yasar11732 at gmail.com
Sun Aug 28 13:22:08 EDT 2011


Hi,

I got confused about classes as an iterator. I saw something like this:

class foo():
    __iter__(self):
        return self
    next(self):
        return something

But then I saw a __next__ method on some code. So what is the deal, which
one should I use and what is the difference?

-- 
http://yasar.serveblog.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110828/3e1d0b5b/attachment.html>


More information about the Python-list mailing list