[Twisted-Python] Using Deferreds

Glyph Lefkowitz glyph at divmod.com
Thu Jun 16 22:31:29 EDT 2005


Kevin Smith wrote:

> 1) Is there a way to re-use Deferreds? It seems that a Deferred instance
> is not usable after a callback has been triggered. When I try to trigger
> a second callback on the same instance a AlreadyCalledError is raised.
> Is there another approach I should be using?

This is intentionally impossible.  A Deferred represents a single 
operation - there are no sensible semantics for re-starting a callback 
chain because you could add a new callback to a Deferred at any time.

> 2) I don't have a concrete reason for needing to do this, but is it
> possible to remove a function registered as a callback from a Deferred?
> I ask this question more out of curiosity rather than any practical need.

Nope.





More information about the Twisted-Python mailing list