[Twisted-Python] addCallbacks issue

Andrew Bennetts andrew-twisted at puzzling.org
Wed Apr 14 19:08:23 MDT 2004


On Tue, Apr 13, 2004 at 10:41:13PM +1000, Tim Allen wrote:
> 
> I think part of the problem is that people speak of "the callback 
> chain", when there's actually two mutually intertwined callback chains.

Well, I think of it as one chain of callback/errback pairs, but given that
I've read defer.py several times and even made some commits to it, I am
probably not a good example of how the average user should be expected to
think about this stuff :)

[...]
> 
> Another way of approaching the concept might be to say that each stage 
> in the chain has to deal with the errors in the chain before it - that 
> is, if you do:
> 
> 	d.addCallbacks(cb, eb)
> 
> then eb needs to handle any errors that arise from the data source, 
> while if you do:
> 
> 	d.addCallback(cb)
> 	d.addErrback(eb)
> 
> then eb needs to handle any errors that arise from the data source, AND 
> any errors that arise from cb.

This is good, straightforward, practical advice on how to actually use these
wacky abstract objects, and should be added to the docs.

Incidentally, Mary has opened a bug based on this discussion, so hopefully
the good ideas people have come up with won't be forgotten :)

    http://www.twistedmatrix.com/bugs/issue596

-Andrew.





More information about the Twisted-Python mailing list