3 ms·
> A function nested in a generator can capture the yield operation from the outer generator, and the nested function can call itself recursively to traverse a t
by bvrmn 3y ago
> A function nested in a generator can capture the yield operation from the outer generator, and the nested function can call itself recursively to traverse a tree or other recursive data structure, yield-ing at each level to produce values for the generator. I don't think you can do that in Python or in many other mainstream languages with generator coroutines.
Automatic yield flattening is a scary feature. Python has explicit control via `yield from`.