Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

Python asyncio doc seems not match the procedure when running #489

Open
utiao opened this issue Jan 24, 2017 · 1 comment
Open

Python asyncio doc seems not match the procedure when running #489

utiao opened this issue Jan 24, 2017 · 1 comment

Comments

@utiao
Copy link

utiao commented Jan 24, 2017

Path:
what's new in 3.5 -- new feature pep 492 asyncio.gather
Discription:
asyncio eventloop will automatically call the gather Gathering_feature object did not passed to it;

Doc like this:

async def coro(): pass
loop = asyncio.get_event_loop()
coros = asyncio.gather(coro(), coro())
loop.run_until_complete(coros)

actually:

import asyncio
from time import sleep
async def f():
print(3)
sleep(1)
print(4)
return 1
print(1)
b=asyncio.gather(f(),f())
b=asyncio.gather(f(),f())
b=asyncio.gather(f(),f())
print(b)
print(11)
a=asyncio.get_event_loop()
print(type(a))
print(type(a.run_until_complete(f())))
print(a.run_until_complete(f()))

result is:
1
<_GatheringFuture pending>
11
<class 'asyncio.windows_events._WindowsSelectorEventLoop'>
3
4
3
4
3
4
3
4
3
4
3
4
3
4
<class 'int'>
3
4
1

@dimaqq
Copy link

dimaqq commented Feb 6, 2017

@utiao Hi, could you possibly do the following:

  • provide links to exact pages
  • use code blocks (e.g. edit your post and add ``` around blocks of code)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants