Message119836
Indeed, the minimal lifecycles are:
GEN_CREATED->GEN_CLOSED (exception thrown in before the generator was even started)
GEN_CREATED->GEN_RUNNING->GEN_CLOSED (initial next() with internal logic that skips all yields)
GEN_CREATED->GEN_RUNNING->GEN_SUSPENDED->GEN_RUNNING->GEN_CLOSED (initial next() with a throw, next or send to close it)
Other cases following the same basic pattern as the last one, they just bounce back and forth between suspended and running more times.
It occurred to me that threads really use the same state machine, it's just that almost nobody writes their own Python thread schedulers, so only _thread and threading care about the suspended/running distinction. There are quite a few different generator schedulers though, so the distinctions matters to more 3rd party code than it does for threads. |
|
Date |
User |
Action |
Args |
2010-10-29 01:28:40 | ncoghlan | set | recipients:
+ ncoghlan, gvanrossum, pitrou |
2010-10-29 01:28:40 | ncoghlan | set | messageid: <1288315720.11.0.959117032588.issue10220@psf.upfronthosting.co.za> |
2010-10-29 01:28:37 | ncoghlan | link | issue10220 messages |
2010-10-29 01:28:37 | ncoghlan | create | |
|