blob: 82feefed08bf7c93b2e678e28ae3c5ee37be6b66 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# Yielding from stopped generator is ok and results in None
def gen():
return 1
# This yield is just to make this a generator
yield
f = gen()
def run():
print((yield from f))
print((yield from f))
print((yield from f))
try:
next(run())
except StopIteration:
print("StopIteration")
# Where "f" is a native generator
def run():
print((yield from f))
f = zip()
try:
next(run())
except StopIteration:
print("StopIteration")
|