[Twisted-Python] sleeping in inlineCallbacks

Glyph Lefkowitz glyph at twistedmatrix.com
Thu Oct 29 04:06:11 EDT 2009

Hi Brian,

In general, please reply on this list inline, with quoting and  
trimming, like so:


This might seem like a minor thing, but it really helps those of us  
who have to follow long discussions and many mailing lists.

Now, on to the main point of your message:

On Oct 28, 2009, at 5:48 PM, Brian Granger wrote:

> I have been using Twisted for years but only recently began to use  
> inlineCallbacks (couldn't give up Python 2.4 support until  
> recently).  This simple asynch. sleep function is fantastic.  Just  
> today I used to it with inlineCallbacks to dramatically clean up  
> some complex deferred logic.

Which asynch sleep function?

I hope you're not talking about this stuff, quoted in your message:

> On Wed, Oct 7, 2009 at 8:28 PM, Andrew Bennetts  
> <andrew at bemusement.org> wrote:
> >    What about Deferred.setTimeout?

Please note spiv's reply:

> Deferred.setTimeout is a poor API and is deprecated (despite what the
> automatically generated API docs think).

and his recommendation:

> So please, don't use setTimeout, and definitely do not recommend it  
> to others!

I hope that, instead, you're talking about the deferLater function  
that was introduced in Twisted 8.0?


This will act like an async 'sleep' if its result is yielded from an  
@inlineCallbacks function.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20091029/c2ab8406/attachment.htm 

More information about the Twisted-Python mailing list