From 076d4d52e1fb4f57c14740527ad11618a318ca93 Mon Sep 17 00:00:00 2001 From: Laurens Van Houtven <_@lvh.io> Date: Fri, 8 Aug 2014 15:11:56 +0200 Subject: [PATCH] Use callbacks instead of d.result Just to make @glyph happy --- README.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index f992561..e0a072f 100644 --- a/README.rst +++ b/README.rst @@ -51,9 +51,13 @@ When accessing a method named in the list, you get an object wrapping it instead. Calling it returns a Deferred. Any arguments passed are passed verbatim to the wrapped method. ->>> d = car_thimble.drive_to("work") ->>> d.result -'driven to work' +>>> def print_(s): +... # can't use from __future__ import print_function because of a +... # doctest limitation :-( +... print s + +>>> d = car_thimble.drive_to("work").addCallback(print_) +driven to work This Deferred has already fired synchronously, because we're using a fake thread pool and reactor.