@@ -18,8 +18,7 @@ class NotSynchronousError(Exception):
1818def sync_perform (dispatcher , effect ):
1919 """
2020 Perform an effect, and return its ultimate result. If the final result is
21- an error, the exception will be raised. This is useful for testing, and
22- also if you're using blocking effect implementations.
21+ an error, the exception will be raised.
2322
2423 This requires that the effect (and all effects returned from any of its
2524 callbacks) be synchronous. If the result is not available immediately,
@@ -42,9 +41,20 @@ def sync_performer(f):
4241 """
4342 A decorator for performers that return a value synchronously.
4443
45- The function being decorated is expected to take a dispatcher and an intent
46- (and not a box), and should return or raise normally. The wrapper function
47- that this decorator returns will accept a dispatcher, an intent, and a box
44+ This decorator should be used if performing the intent will be synchronous,
45+ i.e., it will block until the result is available and the result will be
46+ simply returned. This is the common case unless you're using an
47+ asynchronous framework like Twisted or asyncio.
48+
49+ Note that in addition to returning (or raising) values as normal, you can
50+ also return another Effect, in which case that Effect will be immediately
51+ performed with the same dispatcher. This is useful if you're implementing
52+ one intent which is built on top of other effects, without having to
53+ explicitly perform them.
54+
55+ The function being decorated is expected to take a dispatcher and an
56+ intent, and should return or raise normally. The wrapper function that this
57+ decorator returns will accept a dispatcher, an intent, and a box
4858 (conforming to the performer interface). The wrapper deals with putting the
4959 return value or exception into the box.
5060
0 commit comments