[Twisted-Python] conceptually, why a deferred can't be used more than once?
andrew at bemusement.org
Fri Jul 9 01:06:13 EDT 2010
Jean Daniel wrote:
> Dear list,
> Concerning the concept of the deferred, why is it more useful to go
> with a deferred which gets consumed and can only be fired once?
Because they are basically a way to provide asynchronous function calls. In
plain Python a function call only returns (or raises) once. Deferreds are no
If you want a callback that can be invoked multiple times... well, just pass a
function to the thing generating callbacks. For instance, Protocol objects have
a dataReceived method that may be called many times.
More information about the Twisted-Python