yield from vs yield in for-loop
What Happened? When you use next(iter(instance_of_Class2)), iter() calls .close() on the inner generator when it (the iterator, not the generator!) goes out of scope (and is deleted), while with Class1, iter() only closes its instance >>> g = (i for i in range(3)) >>> b = Class2(g) >>> i = iter(b) # hold iterator open … Read more