Re: [pypy-dev] Would the following shared memory model be possible?
![](https://secure.gravatar.com/avatar/917e9407f1027d3e6e4bc1a16d49b632.jpg?s=120&d=mm&r=g)
Hi JP: Message: 1 Date: Thu, 29 Jul 2010 21:24:58 -0000 From: exarkun@twistedmatrix.com Subject: Re: [pypy-dev] Would the following shared memory model be possible? To: pypy-dev@codespeak.net Message-ID: <20100729212458.2188.24074246.divmod.xquotient.34@localhost.localdomain> Content-Type: text/plain; charset="utf-8"; format="flowed" On 08:39 pm, andrewfr_ice@yahoo.com wrote:
Okay. I attended Ray's Hettinger's talk on Monocle. In the past I have encountered situations where I bumped up with the nesting problem. If I recall, the problem involved request handlers that had a RPC style AND made additional Twisted deferred calls:
class MyRequestHandler(...):
@defer.inlineCallbacks def process(self): try: result = yield client.getPage("http://www.google.com") except Exception, err: log.err(err, "process getPage call failed") else: # do some processing with the result return result
looks reasonable but Python will balk.
JP>Aside from the "return result" (should be defer.returnValue(result), JP>generators can't return with a value), this looks fine to me too. Why JP>do you say Python will balk? Well the return with a value was the deal breaker. I used this example because this is where I came face-to-face with nested generators - and generated a mistrust for them in regard to exotic uses. There was something else about the real example (I am having a hard time finding the posts - somewhere in 2007) - I think it was a very early version of PyAMF and it really wanted a return (HTTP is okay). I believe under the hood, if the protocol returns a deferred or None, the reactor will expect further output in the future. Cheers, Andrew Cheers, Andrew
participants (1)
-
Andrew Francis