[Python-ideas] Generators are iterators

Chris Angelico rosuav at gmail.com
Wed Dec 10 22:52:09 CET 2014


On Thu, Dec 11, 2014 at 8:34 AM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> I think Nick has it nailed -- the difference is that code inside
> a generator function implementing a __next__ method will behave
> differently from that inside an ordinary function implementing
> a __next__ method.

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

ChrisA


More information about the Python-ideas mailing list