[Twisted-Python] Synchronization techniques

Paul G paul-lists at perforge.com
Wed Apr 4 13:49:57 EDT 2007

Brian Granger wrote:
> So what about (2)?  Ignoring the fact that such constructs can't be
> implemented reliably (let's imagine they could be), should you want to
> use them?  I think the answer is this:
> The design of Twisted reflects the realities of an asynchronous, event
> driven world where things can and do go wrong when you least expect
> it.  The error handling decision tree of Deferreds are a reflection of
> this reality.  If you try to make this stuff go away (we have tried ma
> ny times - we are slow learners and very stubborn) you will be
> punished and there will be "weeping and gnashing of teeth."  This
> punishment will take the form of buggy code that is difficult to
> maintain and extend.

agreed, it's what i wrote in the email i've just sent out. if you look at 
some parts of twisted, like pb, and actually try to use them, you'll find 
that it's extremely liberating and useful not to have things hidden from you 
because this sort of infantilization can only end in tears. continuing with 
the pb example, based on personal experience, not having the network 
communications disguised and hidden from you by ordinary function calls 
makes writing non-trivial code practical, nevermind easy. i can't tell you 
how many projects i've seen that used this hiding back when it was en vogue, 
and all of them to a t were either completely borked or barely functional. 
this is all about having the tools to deal with the problem domain using 
concepts that map it properly - you can't deal with asynchrony without 
having it reified, with every consequence that entails. i spent a 
non-trivial amount of time a long time ago playing with generators, bytecode 
hacks and preprocessors to hide this stuff (it's not as damaging to hide it 
selectively once you already thoroughly understand what's going on under the 
hood) and came to the conclusion that i was wrong to want that. now if i 
could do the same with cigarettes and beer .. ;]


More information about the Twisted-Python mailing list