File tree Expand file tree Collapse file tree 4 files changed +11
-5
lines changed
Expand file tree Collapse file tree 4 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -318,7 +318,7 @@ print(next(c)) # 111
318318
319319
320320def print_name (prefix ):
321- print (" Search for" , prefix, " prefix" )
321+ print (" Search for " , prefix, " prefix" )
322322 while True :
323323 name = yield
324324 if prefix in name:
Original file line number Diff line number Diff line change 33
44async def count (): # single event loop
55 print ("One" )
6- yield asyncio .sleep (1 ) # when task reaches here it will sleep to 1 seconds ands says to do other job meantime
6+ await asyncio .sleep (1 ) # when task reaches here it will sleep for 1 second and says to do other job meantime
77 print ("Two" ) # temporary gives control to another function
88
99
Original file line number Diff line number Diff line change 11def coroutine (func ):
2- """A decorator function that eliminates the need to call .next() when starting a coroutine."""
2+ """
3+ A decorator function that eliminates the need to call .next()
4+ when starting a coroutine.
5+ """
36 def start (* args , ** kwargs ):
47 cr = func (* args , ** kwargs )
58 next (cr )
Original file line number Diff line number Diff line change 1+ from typing import Coroutine
2+
3+
14def coroutine ():
25 while True :
3- value = yield # allows to manipulate yielded value
6+ value = yield # allows manipulating yielded value
47 print (value )
58
69
@@ -50,7 +53,7 @@ def infinite_palindromes():
5053
5154
5255def print_name (prefix ):
53- print ("Search for" , prefix , "prefix" )
56+ print ("Search for " , prefix , " prefix" )
5457 while True :
5558 name = yield
5659 if prefix in name :
You can’t perform that action at this time.
0 commit comments