[issue10220] Make generator state easier to introspect

Guido van Rossum report at bugs.python.org
Fri Oct 29 02:43:03 CEST 2010


Guido van Rossum <guido at python.org> added the comment:

I take it back. The 4-value state looks better.

My initial hesitance was that if you ever see GEN_RUNNING you are
probably already in trouble, since you can't call send, next, throw or
even close on a running generator (they all throw ValueError), so why
are you looking at its state at all? But most reasons for looking at
the state are obscure anyway, and from a different perspective it's a
nice state machine. (Note that there's no transition from SUSPENDED to
CLOSED -- you have to go through RUNNING to possibly handle
GeneratorExit.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10220>
_______________________________________


More information about the Python-bugs-list mailing list