Skip to content

Commit da631b9

Browse files
committed
add more yield usage
1 parent 28eb361 commit da631b9

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

13.system/yield.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,18 @@ def event():
2222
next(task) # will raise StopIteration
2323
except Exception as e:
2424
print('yield StopIteration')
25+
26+
if __name__ == '__main__':
27+
28+
def task():
29+
while True:
30+
print('hello')
31+
yield
32+
33+
tmp = task()
34+
while True:
35+
next(tmp)
36+
37+
while True:
38+
print('hello')
39+

0 commit comments

Comments
 (0)