[Twisted-Python] why deferred.setTimeout is not my favorite API method

Andrew Bennetts andrew-twisted at puzzling.org
Sun Apr 18 20:45:07 EDT 2004

On Sun, Apr 18, 2004 at 11:21:45AM -0400, Bob Ippolito wrote:
> On Apr 18, 2004, at 6:16 AM, Andrew Bennetts wrote:
> >I think that timeouts, or cancellations in general, are something that
> >Deferreds should *support*, even though they cannot provide them entirely
> >automatically.  I'll try to explain why.
> Yes, cancellation should be supported in the Deferred object, timeouts 
> should not.  Timeouts are just a specific case of cancellation that can 
> be done outside of the implementation of Deferred.  Cancellation can't, 
> because you need to know where the deferred came from originally in 
> order to figure out how to cancel it and that information is not 
> tracked.

I agree that timeouts can (and should) be implemented on top of
cancellations, which are a more general concept, and because of this I've
changed my mind about fixing setTimeout.

I don't think we should remove setTimeout until we have cancellation
support, though.

I'm happy for setTimeout to be deprecated now, though.

And I never liked the "DON'T USE THIS" docstring, which is just a way of
deprecating without really deprecating ;)


More information about the Twisted-Python mailing list