[Twisted-Python] understanding deferreds

Michael P. Soulier msoulier at digitaltorque.ca
Thu Jan 28 20:57:13 EST 2010


On 29/01/10 Tristan Seligmann said:

> Just to expand on exarkun's answer a little, it might help to
> understand that addCallback and addErrback are simply implemented in
> terms of addCallbacks. Roughly:
> 
> def passthru(arg):
>     return arg
> 
> d.addCallback(cb) is equivalent to d.addCallbacks(cb, passthru)
> 
> d.addErrback(eb) is equivalent to d.addCallbacks(passthru, eb)

I think I understand now. I don't think it's adequately explained here

http://twistedmatrix.com/documents/current/core/howto/defer.html

but the diagram makes more sense now.

Thanks,
Mike
-- 
Michael P. Soulier <msoulier at digitaltorque.ca>
"Any intelligent fool can make things bigger and more complex... It takes a
touch of genius - and a lot of courage to move in the opposite direction."
--Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://twistedmatrix.com/pipermail/twisted-python/attachments/20100128/55e7bcbe/attachment.pgp 


More information about the Twisted-Python mailing list