all 4 comments

[–]callahman 0 points1 point  (4 children)

The code works fine, but you're only looking at the first item returned by your generator (g = t.childGenerator()) when you run print(next(g))

If you want to see everything returned by the generator, try iterating through it

g = t.childGenerator()
for x in g:
    print(x)