[Twisted-Python] PB waitingForAnswers KeyError

Bob Ippolito bob at redivi.com
Sat Jul 23 02:09:33 EDT 2005


On Jul 22, 2005, at 7:56 PM, William Waites wrote:

> or more correctly,
>
> def invert(f):
>     def _i(*av, **kw)
>         e = Event()
>         result = []
>         def _s(res):
>             result.append(res)
>             e.set()
>         def _f():
>             d = maybeDeferred(f, *av, **kw)
>             d.addBoth(_s)
>         reactor.callFromThread(_f)
>         e.wait()
>
>         res = result[0]
>         if isinstance(res, Exception):
>             raise res
>         return res
>     return _i
>
> should this function exist somewhere in twisted?

Maybe if you can provide a tested and documented implementation.

I don't have a use for it, because I keep threads sane and separate,  
so I'm not going to think too hard about whether what you've correct  
is right or not.

-bob





More information about the Twisted-Python mailing list