[Twisted-Python] Returning a DeferredList?

L. Daniel Burr ldanielburr at mac.com
Mon Jun 30 22:02:21 EDT 2008


On Mon, 30 Jun 2008 17:54:33 -0500, Nathan <nathan.stocks at gmail.com> wrote:

> On Mon, Jun 30, 2008 at 4:20 PM, Terry Jones <terry at jon.es> wrote:
>> You're not using deferreds properly. In the simple/typical case, when  
>> you
>> call a function that returns a deferred, you will want to add (at  
>> least) a
>
> I don't think that's true.  Jean-Paul was the one who told me to do it
> that way in the first place:
>
> http://twistedmatrix.com/pipermail/twisted-python/2008-April/017304.html
>

Terry (hi Terry) is correct here.  Your interpretation of Jean-Paul
Calderone's message is flawed, although I certainly understand how
the misinterpretation could occur.  There's a big difference between
the AMP example in that thread, and the example code you posted to
this thread.

> If your theory was true, I would be getting garbage everywhere I
> return (and use) complicated objects, and I'd be getting True
> everywhere that I return booleans.
>

Not necessarily.  I suspect that your real code isn't working the way
your posted example does.

The bottom line is that the code you posted to this thread does not
produce the synchronous behavior that you think it is providing, so
it might be more helpful to provide an example of your real code,
in order for people here to provide you with some better answers.

Hope this helps,

L. Daniel Burr




More information about the Twisted-Python mailing list