[Twisted-Python] ANN: deferred howto/tutorial

Jonathan Simms slyphon at twistedmatrix.com
Sat Oct 23 00:08:21 MDT 2004


Hello all,

I was sitting at Jury Duty today, trying to keep myself from the
inevitable thoughts of suicide, and I started thinking about how to
implement deferreds in C#. I started out by thinking about the logic one
would need to use to implement deferreds in python. I wrote out in my
notebook an implementation and when I got back home, I was suprised to
discover that I wasn't terribly far off. I reflected upon this, and
about what had confused me for so long about deferreds in general.

...and I was really stumped... ;)

Deferreds are simple and elegant. After rewriting trial and dealing with
all of its crazy exception handling, I realised that a lot of that code
could have been made more succinct (if not more understandable) had it
used deferreds to do the error handling and decision making.

I think the thing that confuses most newbies is that deferreds to them
seem like this BLACK BOX. It's this mysterious thing that is going to
CALL YOUR CODE, and the rules about chaining and errback and callback
chains are quite intimidating if you don't have a chunk of familiar
looking code to transition you from python to
Deferredy-Looking-Kool-Aid-Land.

So what i did was write a tutorial on my deferred enlightenment...(pun
intended?) 

I'd appreciate feedback, good or bad. You can find it in svn:HEAD,
at doc/core/howto/tutorial/deferred_tutorial.xhtml


Cheers!
Jonathan D. Simms
slyphon AT twistedmatrix DOT com





More information about the Twisted-Python mailing list