[Twisted-Python] ANN: deferred howto/tutorial

stefan fu at donfu.com
Sun Oct 24 04:53:45 EDT 2004


On 24.10.2004, at 10:08, Tommi Virtanen wrote:
>     def _cbOneBack(self, result):
>           ...
>           d = self.somethingDeferred()
>
>           def format(result, someParams):
>                 return "Result is %r, %r" % (result, someParams)
>           d.addCallback(format, someParams)
>
>           return d

This is a nice visualization of the logical flow, much better than my 
first version.

> Also, I tend to use nested functions for small and mostly trivial 
> things

Make sense. A complex callback of course deserves it's own method. I 
just don't like cluttering up my class-namespace with three mostly 
trivial callbacks/errbacks per method.

Thanks for everyone's feedback on the topic! And thanks for pointing 
out the "twisted-way" in the coding standards doc.
stefan.





More information about the Twisted-Python mailing list