Generator Function in Coroutine
Hi All,
When using a custom generator function in a coroutine, does the generator function execute immediately?
The first part (pre yield) of the generator function we are using logs a time stamp that has to represent the start of the coroutine, but we haven't been able to figure out whether the function is executing immediately when the coroutine starts or is executing later on during the coroutine's loop.
Thanks!
Comments
Hi,
I realize that this reply comes a bit late, but I hope it's still useful!
The pre-yield part of the generator function is executed at the very start of the Run phase for the
coroutinesitem. So yes, it's executed immediately, in the sense that it happens before the actualcoroutinesloop starts. I hope this clears things up.Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!