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. Thanks,<br>
<br>Brian<br><br><div class="gmail_quote">On Wed, Oct 7, 2009 at 8:28 PM, Andrew Bennetts <span dir="ltr"><<a href="mailto:andrew@bemusement.org">andrew@bemusement.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Mikhail Terekhov wrote:<br>
> On Wed, Oct 7, 2009 at 6:04 PM, Phil Christensen <[1]<a href="mailto:phil@bubblehouse.org">phil@bubblehouse.org</a>><br>
<div class="im">> wrote:<br>
><br>
> Paul's example will work just fine. Also, AFAIK there's no existing<br>
> twisted function to do replicate an asynchronous sleep() in this way.<br>
><br>
> -phil<br>
><br>
> What about Deferred.setTimeout?<br>
</div>> [2]<a href="http://twistedmatrix.com/documents/current/api/twisted.internet.defer.Deferred.html#setTimeout" target="_blank">http://twistedmatrix.com/documents/current/api/twisted.internet.defer.Deferred.html#setTimeout</a><br>
<div class="im">> IMHO it solves similar problem.<br>
<br>
</div>Deferred.setTimeout is a poor API and is deprecated (despite what the<br>
automatically generated API docs think).<br>
<<a href="http://twistedmatrix.com/trac/ticket/178" target="_blank">http://twistedmatrix.com/trac/ticket/178</a>> has some discussion (and links to<br>
more discussion) explaining what's wrong with it, and what a good replacement<br>
would look like.<br>
<br>
So please, don't use setTimeout, and definitely do not recommend it to others!<br>
<font color="#888888"><br>
-Andrew.<br>
</font><div><div></div><div class="h5"><br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</div></div></blockquote></div><br>