How to yield results from a nested generator function?
You may have to use the new yield from, available since Python 3.3, known as “delegated generator”. If I understood the question correctly, I came to the same issue, and found an answer elsewhere. I wanted to do something like this: def f(): def g(): do_something() yield x … yield y do_some_other_thing() yield a … … Read more