[Twisted-Python] Deferred documentation rewrite

Edward Z. Yang ezyang at MIT.EDU
Mon Aug 3 18:00:07 EDT 2009

I have updated my draft here:


The most notable change is I've removed the section "From Synchronous to
Asynchronous".  I believe (and I think other people agree with me) that
this is an important topic to cover, but it's really *hard* to teach
asynchronous programming and I'd like to think a bit more about how I'd
like to frame the subject.  There are at least two issues that we have
to deal with:

* Why asynchronous?
    - Define synchronous and asynchronous
    - Multiplexing IO
    - Introduce a simple reactor based on select()
* Why callbacks?
    - Asynchronous interaction to synchronous interaction
    - Delocalized execution (the parser example)
    - High level functions in Python review

Quite frankly, I'm stumped on "defining synchronous and asynchronous."
Asynchronous had always made sense to me, coming from JavaScript, since
it was "you click this button and something should happen!"  But that
is a very different use-case of asynchronous programming than Twisted is.
And Glyph raised some very salient concerns about what we were trying to
teach people.  I just don't know what direction people are coming from.

As such, the document now is targeted to "people who know the basics
of asynchronous programming and grok callbacks", and I've incorporated
Itamar's excellent suggesting of comparing explicit callback parameters
and the Deferred object, which I hope dispells the notion of Deferred
being magical fairly well (my assertion is Deferred is merely an
abstraction over said callback parameters.)  I've also fully fleshed
out the Deferreds reference; any omissions are my fault.

The plan next is to discuss composing deferreds (which will also
touch on when you should and how to create your own deferreds, as
well as deferredlist) and the convenience primitives.


More information about the Twisted-Python mailing list