yield akış

This commit is contained in:
Mert Gör ☭ 2023-09-06 19:27:03 +03:00
parent a51ea42073
commit 5d1f116933
No known key found for this signature in database
GPG Key ID: 2100A876D55B39B9
1 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
def foo():
print('one')
yield
print('two')
yield
print('three')
try:
g = foo()
iterator = iter(g)
next(iterator)
next(iterator)
next(iterator)
except:
pass