Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

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 coroutines item. So yes, it's executed immediately, in the sense that it happens before the actual coroutines loop starts. I hope this clears things up.

    Cheers!

    Sebastiaan

    There's much bigger issues in the world, I know. But I first have to take care of the world I know.
    cogsci.nl/smathot

Sign In or Register to comment.