[Python-ideas] The async API of the future: Twisted and Deferreds
Guido van Rossum
guido at python.org
Sun Oct 14 19:39:59 CEST 2012
On Sun, Oct 14, 2012 at 9:18 AM, Laurens Van Houtven <_ at lvh.cc> wrote:
> On Sun, Oct 14, 2012 at 5:53 PM, Guido van Rossum <guido at python.org> wrote:
>> A readable version of this could should not have to use lambdas.
> In a lot of Twisted code, it happens with methods as callback methods,
> something like:
> d = self._doRPC(....)
> d.addCallbacks(self._formatResponse, self._formatException)
> That doesn't talk about gatherResults, but hopefully it makes the idea
> clear. A lot of the legibility is dependant on making those method names
> sensible, though. Our in-house style guide asks for limiting functions to
> about ten lines, preferably half that. Works for us.
I quite understand that in your ecosystem you've found best practices
for every imaginable use case. And I understand that once you're part
of the community and have internalized the idioms and style, it's
quite readable. But you haven't shaken my belief that we can do better
with the current version of the language (3.3).
(FWIW, I think it would be a good idea to develop a "reference
implementation" of many of these ideas outside the standard library.
Depending on whether we end up adopting yield <future> or yield from
<generator> it might even support versions of Python 3 before 3.3. I
certainly don't want to have to wait for 3.4 -- although that's the
first opportunity for incorporating it into the stdlib.)
--Guido van Rossum (python.org/~guido)
More information about the Python-ideas