Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #63408

Re: Trying to wrap my head around futures and coroutines

References <20140107022958.GA59457@cskk.homeip.net> <20140107024521.GA75679@cskk.homeip.net>
Date 2014-01-06 21:15 -0600
Subject Re: Trying to wrap my head around futures and coroutines
From Skip Montanaro <skip@pobox.com>
Newsgroups comp.lang.python
Message-ID <mailman.5117.1389064565.18130.python-list@python.org> (permalink)

Show all headers | View raw


>From the couple responses I've seen, I must have not made myself
clear. Let's skip specific hypothetical tasks. Using coroutines,
futures, or other programming paradigms that have been introduced in
recent versions of Python 3.x, can traditionally event-driven code be
written in a more linear manner so that the overall algorithms
implemented in the code are easier to follow? My code is not
multi-threaded, so using threads and locking is not really part of the
picture. In fact, I'm thinking about this now precisely because the
first sentence of the asyncio documentation mentions single-threaded
concurrent code: "This module provides infrastructure for writing
single-threaded concurrent code using coroutines, multiplexing I/O
access over sockets and other resources, running network clients and
servers, and other related primitives."

I'm trying to understand if it's possible to use coroutines or objects
like asyncio.Future to write more readable code, that today would be
implemented using callbacks, GTK signals, etc.

S

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Trying to wrap my head around futures and coroutines Skip Montanaro <skip@pobox.com> - 2014-01-06 21:15 -0600

csiph-web