[Twisted-Python] Suggestion for Deferred docs

I know this would have helped me, maybe it would others.
In the documentation on Deferred's in the howto section, the examples that show a blocking operation and then a non blocking operation do not show what happened to the blocking code, it just conveniently disappears. For someone new to async programming it might help to give an example that shows the blocking code being called via deferToThread. In other words show how you would handle blocking code. It doesn't matter if there are 10 ways of doing it, just one example I think would go a long ways to illustrating the complete idea. I know when I was reading about Deferreds for the first time, I was sitting there thinking 'Ok, I know the example doesn't block now because they just conveniently yanked out the blocking code!!, but what DID they do with it?'
Chris

On Wed, Feb 09, 2005, snacktime wrote:
I know this would have helped me, maybe it would others.
It probably will, thanks. Any chance you can file it as a bug (level "bug" or "feature"), whatever you think is appropriate, and assign it to me, user hypatia? The bug tracker is at [1].
In the bug, mention the URL of the document you're talking about -- I've changed the async howto quite a lot in SVN and I need to know whether you're talking about the release version or not (incidently, you can see the SVN version of the docs at [2]).
Thanks a lot,
Mary
[1] http://twistedmatrix.com/bugs/ [2] http://twistedmatrix.com/users/warner/doc-latest/

snacktime wrote:
In the documentation on Deferred's in the howto section, the examples that show a blocking operation and then a non blocking operation do not show what happened to the blocking code, it just conveniently disappears. For someone new to async programming it might help to
The preferred approach is not to move the blocking call into a thread, but to actually replace it with a non-blocking call.
E.g. instead of calling a getStuffFromNetwork() that blocks, call asyncStuffGetter() that sends a request, returns a Deferred, and when the reactor tells asyncStuffGetter() that it got a reply, it calls deferred.callback() with the data.
participants (3)
-
Mary Gardiner
-
snacktime
-
Tommi Virtanen