You’re partially correct about the python yield
statement from what I understand. They construct a generator
which is a type of iterator, but I think that iterator is implemented with a type of coroutine, similar to the julia Task
. The @pygen
macro implements the closest julia equivalent I can find: a Task
that communicates over a Channel
in v0.6, or previous to v0.6 a Task
that communicates via produce()
and consume()
.
Now, if there was a way to compile a function with yield statements into a nice high performance iterator (sounds like c# does this?) that would be amazing… A brief play with these Channels shows they’re no competition for an iterator when it comes to performance.