[Python-Dev] metaclass insanity

Guido van Rossum guido@python.org
Tue, 05 Nov 2002 11:29:29 -0500


[Just]
> >> No, the generator-iterator can hold state in the form of local
> >> variables. That isn't used in this example, though.

[David]
> > Ahh, closures...

[Aahz]
> Huh.  Do other people agree that generators are a form of closures?

Not really.  Closures (in Python) reference local variables of outer
functions.  Generators don't have to do that.

Maybe David meant continuations?  Generators aren't really
continuations either -- they save only a single Python stack frame.
But they are definitely related to them.  I see no connection with
closures.

--Guido van Rossum (home page: http://www.python.org/~guido/)