[Twisted-Python] How to force synchronous behavior

Jean-Paul Calderone exarkun at divmod.com
Sat Oct 29 12:58:13 MDT 2005


On Sat, 29 Oct 2005 10:41:45 -0700, Scott Lamb <slamb at slamb.org> wrote:
>
>On 29 Oct 2005, at 09:50, Jean-Paul Calderone wrote:
>>>There is deferredResult function somewhere in trial (twisted  testing) 
>>>package,  deferredResult(somedeferred)  just waits  for  this deferred - 
>>>yielding control to the reactor  repeatably. This  is probably what 
>>>original poster looks for.
>>
>>Because there seems to be so much confusion on this point,
>>let me re-iterate Itamar's response:
>>
>>deferredResult is *broken*.  It does not work now.  It never
>>worked in the past.  If you use it, your program will suck and
>>die and you will be sad and the only advise you will get
>>to fix it will be to stop using deferredResult, which will
>>probably mean rewriting a significant portion of your program,
>>since you cannot write asynchronous programs synchronously and
>>expect them to work.
>>
>>This is not a conditional point.  It does not depend on
>>anything.  It is a simple, unavoidable fact.  Disregard it at
>>your own certain peril.
>
>Why does twisted contain functions which are never to be used? If it  can't 
>be fixed, why not remove it?

It will be removed shortly.  deferredResult and deferredError have been deprecated since r14685 (Gee, I wish I knew what release that corresponded to - if I were to guess, I'd say 2.1), and will probably be removed in one of the next two releases.  A similarly broken function, wait(), will be deprecated in the next release and removed sometime after that.

Why were they added in the first place?  It was mistakenly thought that they might be able to work.

Jp




More information about the Twisted-Python mailing list