Skip to content

Commit 29d6835

Browse files
committed
updated some examples from ch. 17 e 18 to Python 3.7
1 parent eeb6b3d commit 29d6835

File tree

14 files changed

+2
-147
lines changed

14 files changed

+2
-147
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,15 @@ async def slow_function(): # <5>
3131

3232

3333
async def supervisor(): # <7>
34-
spinner = asyncio.ensure_future(spin('thinking!')) # <8>
34+
spinner = asyncio.create_task(spin('thinking!')) # <8>
3535
print('spinner object:', spinner) # <9>
3636
result = await slow_function() # <10>
3737
spinner.cancel() # <11>
3838
return result
3939

4040

4141
def main():
42-
loop = asyncio.get_event_loop() # <12>
43-
result = loop.run_until_complete(supervisor()) # <13>
44-
loop.close()
42+
result = asyncio.run(supervisor()) # <12>
4543
print('Answer:', result)
4644

4745

0 commit comments

Comments
 (0)