Author ncoghlan
Recipients gvanrossum, ncoghlan, pitrou
Date 2010-10-29.01:28:37
SpamBayes Score 0.000566154
Marked as misclassified No
Message-id <>
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:40ncoghlansetrecipients: + ncoghlan, gvanrossum, pitrou
2010-10-29 01:28:40ncoghlansetmessageid: <>
2010-10-29 01:28:37ncoghlanlinkissue10220 messages
2010-10-29 01:28:37ncoghlancreate