3 ms·
I see your function and "yield" (pun definitely intended) the following: def flatten(children=[], **other): if other: yield other for child
by TrianguloY 3y ago
I see your function and "yield" (pun definitely intended) the following:
def flatten(children=[], **other):
if other: yield other
for child in children: yield from flatten(**child)
- strunz 3y agoThat's pretty brilliant to use `children` as the keyword name, thanks!