Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #89980
| From | Marko Rauhamaa <marko@pacujo.net> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: asyncio: What is the difference between tasks, futures, and coroutines? |
| Date | 2015-05-05 20:45 +0300 |
| Organization | A noiseless patient Spider |
| Message-ID | <878ud27waw.fsf@elektro.pacujo.net> (permalink) |
| References | <344fd8f6-75c1-4b7d-888d-c5c9d4498ec3@googlegroups.com> |
Paul Moore <p.f.moore@gmail.com>: > But I don't understand what a Future is. A future stands for a function that is scheduled to execute in the background. Personally, I have never found futures a very useful idiom in any language (Scheme, Java, Python). Or more to the point, concurrency and the notion of a function don't gel well in my mind. See also: <URL: http://en.wikipedia.org/wiki/Futures_and_promises> > A Task is a subclass of Future, but the documentation doesn't say what > it *is*, A task is almost synonymous with a future. It's something that needs to get done. -- I think asyncio is a worthwhile step up from the old asyncore module. Its main advantage is portability between operating systems. Also, it has one big advantage over threads: events can be multiplexed using asyncio.wait(return_when=FIRST_COMPLETED). However, I happen to have the privilege of working with linux so select.epoll() gives me all the power I need to deal with asynchrony. The asyncio model has the same basic flaw as threads: it makes the developer think of concurrency in terms of a bunch of linear streaks of execution. I much prefer to look at concurrency through states and events (what happened? what next?). My preferred model is known as "Callback Hell" (qv.). Asyncio seeks to offer a salvation from it. However, I am at home in the Callback Hell; equipped with Finite State Machines, the inherent complexities of the Reality are managed in the most natural, flexible manner. Marko
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
asyncio: What is the difference between tasks, futures, and coroutines? Paul Moore <p.f.moore@gmail.com> - 2015-05-05 08:22 -0700
Re: asyncio: What is the difference between tasks, futures, and coroutines? Zachary Ware <zachary.ware+pylist@gmail.com> - 2015-05-05 11:11 -0500
Re: asyncio: What is the difference between tasks, futures, and coroutines? Paul Moore <p.f.moore@gmail.com> - 2015-05-05 10:55 -0700
Re: asyncio: What is the difference between tasks, futures, and coroutines? Terry Reedy <tjreedy@udel.edu> - 2015-05-05 13:15 -0400
Re: asyncio: What is the difference between tasks, futures, and coroutines? Marko Rauhamaa <marko@pacujo.net> - 2015-05-05 20:45 +0300
Re: asyncio: What is the difference between tasks, futures, and coroutines? Rustom Mody <rustompmody@gmail.com> - 2015-05-05 21:47 -0700
Re: asyncio: What is the difference between tasks, futures, and coroutines? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-06 15:48 +1000
Re: asyncio: What is the difference between tasks, futures, and coroutines? Rustom Mody <rustompmody@gmail.com> - 2015-05-07 21:06 -0700
Re: asyncio: What is the difference between tasks, futures, and coroutines? Chris Angelico <rosuav@gmail.com> - 2015-05-08 14:33 +1000
Re: asyncio: What is the difference between tasks, futures, and coroutines? Rustom Mody <rustompmody@gmail.com> - 2015-05-07 21:53 -0700
Re: asyncio: What is the difference between tasks, futures, and coroutines? Rustom Mody <rustompmody@gmail.com> - 2015-05-07 21:55 -0700
Re: asyncio: What is the difference between tasks, futures, and coroutines? Chris Angelico <rosuav@gmail.com> - 2015-05-08 15:09 +1000
Re: asyncio: What is the difference between tasks, futures, and coroutines? Rustom Mody <rustompmody@gmail.com> - 2015-05-07 23:36 -0700
Re: asyncio: What is the difference between tasks, futures, and coroutines? Chris Angelico <rosuav@gmail.com> - 2015-05-08 16:42 +1000
Re: asyncio: What is the difference between tasks, futures, and coroutines? Dave Angel <davea@davea.name> - 2015-05-08 07:53 -0400
Re: asyncio: What is the difference between tasks, futures, and coroutines? Chris Angelico <rosuav@gmail.com> - 2015-05-08 23:02 +1000
Re: asyncio: What is the difference between tasks, futures, and coroutines? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-05-06 09:11 -0400
Re: asyncio: What is the difference between tasks, futures, and coroutines? Rustom Mody <rustompmody@gmail.com> - 2015-05-07 21:20 -0700
Re: asyncio: What is the difference between tasks, futures, and coroutines? Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-05 11:46 -0600
Re: asyncio: What is the difference between tasks, futures, and coroutines? Paul Moore <p.f.moore@gmail.com> - 2015-05-05 11:03 -0700
Re: asyncio: What is the difference between tasks, futures, and coroutines? Skip Montanaro <skip.montanaro@gmail.com> - 2015-05-05 12:55 -0500
Re: asyncio: What is the difference between tasks, futures, and coroutines? Terry Reedy <tjreedy@udel.edu> - 2015-05-05 18:38 -0400
csiph-web