Skip to content

Commit 53ad8a1

Browse files
committed
point people to sync_perform, not perform
1 parent 3ef27aa commit 53ad8a1

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ A very quick example of using Effects:
4545
.. code:: python
4646
4747
from __future__ import print_function
48-
from effect import perform, sync_performer, Effect, TypeDispatcher
48+
from effect import sync_perform, sync_performer, Effect, TypeDispatcher
4949
5050
class ReadLine(object):
5151
def __init__(self, prompt):
@@ -65,14 +65,14 @@ A very quick example of using Effects:
6565
error=lambda e: print("sorry, there was an error. {}".format(e)))
6666
6767
dispatcher = TypeDispatcher({ReadLine: perform_read_line})
68-
perform(dispatcher, effect)
68+
sync_perform(dispatcher, effect)
6969
7070
if __name__ == '__main__':
7171
main()
7272
7373
7474
``Effect`` takes what we call an ``intent``, which is any object. The
75-
``dispatcher`` argument to ``perform`` must have a ``performer`` function
75+
``dispatcher`` argument to ``sync_perform`` must have a ``performer`` function
7676
for your intent.
7777

7878
This has a number of advantages. First, your unit tests for ``get_user_name``

docs/source/intro.rst

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,19 @@ A (sometimes) nicer syntax is provided for adding callbacks, with the
6969
yield Effect(Print("Hello,", name))
7070
7171
Finally, to actually perform these effects, they can be passed to
72-
:func:`effect.perform`, along with a dispatcher which looks up the performer
73-
based on the intent.
72+
:func:`effect.sync_perform`, along with a dispatcher which looks up the
73+
performer based on the intent.
7474

7575
.. code:: python
7676
77+
from effect import sync_perform
78+
7779
def main():
7880
eff = greet()
7981
dispatcher = ComposedDispatcher([
8082
TypeDispatcher({ReadLine: perform_read_line}),
8183
base_dispatcher])
82-
perform(dispatcher, eff)
84+
sync_perform(dispatcher, eff)
8385
8486
This has a number of advantages. First, your unit tests for ``get_user_name``
8587
become simpler. You don't need to mock out or parameterize the ``raw_input``
@@ -115,7 +117,8 @@ A quick tour, with definitions
115117
- Box: An object that has ``succeed`` and ``fail`` methods for providing the
116118
result of an effect (potentially asynchronously). Usually you don't need
117119
to care about this, if you define your performers with
118-
:func:`effect.sync_performer` or :func:`effect.twisted.deferred_performer`.
120+
:func:`effect.sync_performer` or ``txeffect.deferred_performer`` from the
121+
`txeffect`_ package.
119122

120123
There's a few main things you need to do to use Effect.
121124

@@ -126,11 +129,12 @@ There's a few main things you need to do to use Effect.
126129
``Effect(HTTPRequest(...))`` and attach callbacks to them with
127130
:func:`Effect.on`.
128131
- As close as possible to the top-level of your application, perform your
129-
effect(s) with :func:`effect.perform`.
130-
- You will need to pass a dispatcher to :func:`effect.perform`. You should create one
131-
by creating a :class:`effect.TypeDispatcher` with your own performers (e.g. for
132-
``HTTPRequest``), and composing it with :obj:`effect.base_dispatcher` (which
133-
has performers for built-in effects) using :class:`effect.ComposedDispatcher`.
132+
effect(s) with :func:`effect.sync_perform`.
133+
- You will need to pass a dispatcher to :func:`effect.sync_perform`. You should
134+
create one by creating a :class:`effect.TypeDispatcher` with your own
135+
performers (e.g. for ``HTTPRequest``), and composing it with
136+
:obj:`effect.base_dispatcher` (which has performers for built-in effects)
137+
using :class:`effect.ComposedDispatcher`.
134138

135139

136140
Callback chains

0 commit comments

Comments
 (0)