[Twisted-Python] Two main loops

Jean-Paul Calderone exarkun at divmod.com
Mon Nov 12 17:59:37 EST 2007


On Mon, 12 Nov 2007 21:17:47 -0000, glyph at divmod.com wrote:
>On 06:23 pm, jasper at peak.org wrote:
>>glyph at divmod.com wrote:
>
> [snip]
>
>callRemote *can't* do this in a general manner and remain compatible with 
>PB's existing semantics.  It would be extraordinarily difficult to come up 
>with semantics that would make sense for this.  Consider:
>
>  bob = Mob(hitPoints=3)
>  jethro = Player()
>  jethro.callRemote("enterSensoryRange", bob)
>  bob.hitPoints += 1
>
>How many hit points does Jethro think Bob has?  Probably 3, but if PB might 
>be breaking up serialization work into separate reactor turns for you behind 
>your back, then maybe 4.  Given that there's no way to know, you don't know 
>whether you have to send Jethro an update to bob's hit points or not.
>
>If you can figure out how to answer this question in a way that makes sense 
>(i.e. never uses the word "maybe") then you might be able to implement 
>something very cool and useful.  I certainly can't think of a way to do it, 
>though.  Good luck!
>

It's always possible to provide new behavior - all you have to do is
provide a new API.  For example, RemoteReference.callRemoteAsyncly().

Jean-Paul




More information about the Twisted-Python mailing list