1# Case of terminating subgen using return with value 2def gen(): 3 yield 1 4 yield 2 5 return 3 6 7def gen2(): 8 print("here1") 9 print((yield from gen())) 10 print("here2") 11 12g = gen2() 13print(list(g)) 14 15 16# StopIteration from within a Python function, within a native iterator (map), within a yield from 17def gen7(x): 18 if x < 3: 19 return x 20 else: 21 raise StopIteration(444) 22 23def gen8(): 24 print((yield from map(gen7, range(100)))) 25 26g = gen8() 27print(list(g)) 28