[Twisted-Python] A pseudo-deferred class that can be canceled

Terry Jones terry at jon.es
Tue Jan 5 06:25:33 EST 2010

>>>>> "Andrew" == Andrew Bennetts <andrew at bemusement.org> writes:

Andrew> I think the key thing is to remember there are two distinct parts:

Andrew> 1) an operation (which eventually will have a result or failure)
Andrew> 2) a result 
Andrew> A Deferred takes care of managing 2.  It's a placeholder for that
Andrew> result, and it can track callbacks that need to be called when it
Andrew> arrives, etc.

Andrew> We currently don't have any formal idioms for 1.  I think this is
Andrew> what you're trying to address.  After all, it's not the result that
Andrew> times out or that you might want to cancel, it's the operation that
Andrew> is expected to generate it.

No, I'm only dealing with 2, not at all with 1. 1 is too complicated and in
a later posting I wrote that I didn't think we should be trying to
interfere with the deferred processing and that cancel is not really a good

Andrew> I don't think it's wise to conflate the two concepts, so I think
Andrew> CancellableDeferred is a poor name.

OK, I think I agree.

Anyway, your mail gave me an idea for how to make the class more
useful. I'll code it, maybe even test it :-), and will post again.


More information about the Twisted-Python mailing list