[Twisted-Python] understanding deferreds

Landreville landreville at deadtreepages.com
Mon Feb 1 10:24:07 EST 2010

On Sat, Jan 30, 2010 at 2:16 AM, Andrew Bennetts <andrew at bemusement.org> wrote:
> twisted-web at udmvt.ru wrote:
> [...]
>> Is it true, that adding many callback functions as filters is elegant,
>> but impractical solution?
>> Since there is only a [linear] list of pairs (callback, errback), the last errbacks
>> have to be complex to distinguish the failures, that came from the previous callback
>> from failures, that traverse the errback chain from the beginning.
> This is no different to regular Python code, which has a linear call stack which
> can have exception handlers at any point on the stack.  The exact same tradeoffs
> apply about which exceptions to raise and which to catch, and at what points.
> -Andrew.

In normal python code you might put each filter into a try/except
block, wouldn't this be equivalent to putting a callback and errback
(addCallbacks) each time you are adding a callback. So that the
errback would then know which callback (the previous one) failed.

More information about the Twisted-Python mailing list