Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75078 > unrolled thread
| Started by | Yaşar Arabacı <yasar11732@gmail.com> |
|---|---|
| First post | 2014-07-23 13:58 +0300 |
| Last post | 2014-07-23 13:58 +0300 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Question about asyncio doc example Yaşar Arabacı <yasar11732@gmail.com> - 2014-07-23 13:58 +0300
| From | Yaşar Arabacı <yasar11732@gmail.com> |
|---|---|
| Date | 2014-07-23 13:58 +0300 |
| Subject | Re: Question about asyncio doc example |
| Message-ID | <mailman.12233.1406113124.18130.python-list@python.org> |
asyncio.sleep() returns you a Future. When you yield from a future, your coroutine blocks, until the Future completes. In the meantime, event loop continutes to execute other things that are waiting to be executed. The Future returned from asyncio.sleep gets completed after specified seconds. 2014-07-23 13:43 GMT+03:00 Saimadhav Heblikar <saimadhavheblikar@gmail.com>: > Hi, > > The example in question is > https://docs.python.org/3/library/asyncio-task.html#example-hello-world-coroutine. > I'd like to learn the purpose of the statement > "yield from asyncio.sleep(2)" in that example. > > In particular, I'd like to know if asyncio.sleep() is used as a > substitute for slow/time consuming operation, i.e. in real code, > whether there will be a real time consuming statement in place of > asyncio.sleep(). > > -- > Regards > Saimadhav Heblikar > -- > https://mail.python.org/mailman/listinfo/python-list -- http://ysar.net/
Back to top | Article view | comp.lang.python
csiph-web