[Twisted-Python] callback style question

Justin Johnson justinjohnson at fastmail.fm
Fri Jun 13 14:52:52 MDT 2003


> d = xmlrpc.Proxy("http://localhost:8080/").callRemote("foo.bar", 1, 2)
> instead of 
> xmlrpclib.ServerProxy("http://localhost:8080").foo.bar(1, 2)

Okay, that's what I thought.  I was more wondering about the callbacks.
 
> For callbacks, yes, you need to use a function, bit that can be a lmbda
> too.
> 
> d.addCallback(int).addCallback(lambda x: x*2) # convert to int and
> multiply by 2

What is the difference between chaining callbacks together like you did
above and doing it like...

d.addCallback(int)
d.addCallback(lambda x: x*2)

I apologize, I am in the process of reading the Deferred HOWTO, and
should've finished before posting.  :-(
-Justin




More information about the Twisted-Python mailing list