generator function within a generator function doesn't execute?
Sami Hangaslammi
shangius at yahoo.com
Fri Jul 25 06:45:03 EDT 2003
thedustbustr at aol.com (TheDustbustr) wrote in message news:<20030724190941.18070.00000520 at mb-m17.aol.com>...
> <code>
<snip>
> </code>
> However, when run, the sleep function doesn't execute. It doesn't even print
> "In Sleep". It never gets called, even though I say sleep(1.5) in cutscene().
> Run it for yourself if you don't believe me.
Calling sleep(2.5) isn't supposed to run anything. It just creates a
generator object. Calling it from within another generator makes no
difference. You need to manually unwind the sleep generator to your
scheduler, so instead of
sleep(2.5)
do
for x in sleep(2.5): yield x
More information about the Python-list
mailing list