yield none example
This commit is contained in:
parent
6fed23b2ed
commit
b7f1d07142
13
python-temel/yield.none.py
Normal file
13
python-temel/yield.none.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
def bar(n):
|
||||
for i in range(n):
|
||||
print('New iteration')
|
||||
yield i
|
||||
print('end')
|
||||
|
||||
print(type(bar)) # <class 'function'>
|
||||
|
||||
g = bar(3)
|
||||
print(type(g)) # <class 'generator'>
|
||||
|
||||
for i in g:
|
||||
print(i)
|
Loading…
Reference in New Issue
Block a user