[Python-ideas] Generators are iterators

Greg Ewing greg.ewing at canterbury.ac.nz
Wed Dec 10 23:00:32 CET 2014


Chris Angelico wrote:
> Hang on. When would code inside a generator function implement
> __next__? A generator function is a valid way of implementing
> __iter__, not __next__.

Well, it kind of does both at once.

-- 
Greg


More information about the Python-ideas mailing list