[Twisted-Python] Wrapping a Perspective

Phil Mayers p.mayers at imperial.ac.uk
Thu Sep 6 04:51:13 MDT 2007


> I've only been playing with Twisted seriously for a couple of weeks,
> but as far as I understand inline callbacks, they just make the code
> 'look' synchronous, but the end result is still a deferred.  In my
> playing with them, they make twisted code much more succinct and
> generally easier to read, but it is all still really just deferreds
> underneath and there is no actual blocking going on.

Correct. Effectively, it uses python generators to make the code "nice";
state variables can be kept as function-locals, and flow control can be
somewhat easier to visualise.

> 
> I want to have my python code being called from an external process
> via COM, and the external process will expect to be calling a class
> method that will do something (blocking as long as required) and then
> return the result. Rewriting the external app to deal with everything
> being async is not an option.

I suggest you abandon Perspective Broker; it's a fully async protocol,
and by trying to call it in a sync/blocking manner you're going to get
nowhere fast.

Use something easy like XMLRPC. Twisted can implement that as a server
with full deferred-capable semantics, it'll run over HTTPS, it's got
authentication, it's got .net bindings etc.







More information about the Twisted-Python mailing list