IronPython-0.6 is now available!
derek.thomson at gmail.com
Sat Jul 31 05:37:35 CEST 2004
On Fri, 30 Jul 2004 08:50:16 +0200, Valentino Volonghi aka Dialtone
<dialton3#nospam.jjjjkikk at virgilio.it> wrote:
> On Fri, 30 Jul 2004 10:11:13 +1000, Derek Thomson wrote:
> > I suspect he'll be disappointed with "Twisted", as I was. I had a
> > quick look at it, and the support for RPC is primitive, at best.
> > It's a "round-peg-square-hole" situation given that Twisted is "event
> > based", but it's pretty hard to build a distributed object system if
> > you can't call a method on a remote object easily ... still, it may
> > just be a matter of focus (i.e. the Twisted team haven't really
> > haven't done much in the area of RPC/distributed objects yet, by the
> > look of it). It will be interesting to see how it develops over time.
> Err... What do you mean? Twisted has, at least, 3 different ways of doing
> RPC: Perspective Broker, SOAP and XML-RPC.
Yeah, I know - I said "easily" :) It's basically the client side API I
have a problem with:
> from twisted.spread import pb
> from twisted.internet import reactor
> from twisted.python import util
> factory = pb.PBClientFactory()
> reactor.connectTCP("localhost", 8789, factory)
> d = factory.getRootObject()
> d.addCallback(lambda object: object.callRemote("echo", "hello network"))
> d.addCallback(lambda _: reactor.stop())
So, why can't it just be basically:
... as it is in CORBA and (other) XML-RPC and SOAP toolkits I've used.
I also have a problem with the insistence on the use of asynchronous
callbacks. In order to use the result of the RPC call later in the
main flow of my code, I have to somehow block in the main thread for
the the result to be returned from the server via the callback - this
is something that can be done for me, and is handled simply and
transparently in other RPC toolkits/mechanisms I've used.
I'll try to characterize this with a simple example. How would I write
something like this, where I have three distributed objects:
i = an_object.get_value()
j = another_object.get_value()
k = yet_another_object.combine(i, j)
... and now finally use "k" in my code?
I could be missing something, but isn't that going to turn into a mess
of dependant callbacks in Twisted? Aren't I going to have to write a
whole lot of code that blocks until the results come back? I don't
mean this as a challenge or a judgement anything, I'd honestly like to
know - I would like to look further into Twisted but was pretty much
put off by this issue right from the start.
More information about the Python-list