[Twisted-Python] Deferred.callback() v. Deferred.called

Itamar Shtull-Trauring itamar at itamarst.org
Wed Feb 8 13:45:11 EST 2006

On Wed, 2006-02-08 at 10:23 -0800, Lenny G Arbage wrote:

> def waitForDeferredResult(d):
>     while not d.called:
>         reactor.iteratoe(0.1)
>     return d.result

Don't do that. Trial tests support returning Deferreds, and if necessary
used with deferredGenerator you can make tests that don't involve
defining a lot of callback functions. Do not reactor.iterate() yourself.

Deferred.result and Deferred.called are private if I'm not mistaken.
Don't use them.

More information about the Twisted-Python mailing list