downgrade from Sphinx-specific markup to plain docutils

This commit is contained in:
Łukasz Langa 2013-05-23 00:38:27 +02:00
parent 593595891d
commit 276e3cb152
1 changed files with 4 additions and 12 deletions

View File

@ -62,9 +62,7 @@ User API
To define a generic function, decorate it with the ``@singledispatch``
decorator. Note that the dispatch happens on the type of the first
argument, create your function accordingly:
.. code-block:: pycon
argument, create your function accordingly::
>>> from functools import singledispatch
>>> @singledispatch
@ -75,9 +73,7 @@ argument, create your function accordingly:
To add overloaded implementations to the function, use the
``register()`` attribute of the generic function. It takes a type
parameter:
.. code-block:: pycon
parameter::
>>> @fun.register(int)
... def _(arg, verbose=False):
@ -93,18 +89,14 @@ parameter:
... print(i, elem)
To enable registering lambdas and pre-existing functions, the
``register()`` attribute can be used in a functional form:
.. code-block:: pycon
``register()`` attribute can be used in a functional form::
>>> def nothing(arg, verbose=False):
... print("Nothing.")
...
>>> fun.register(type(None), nothing)
When called, the function dispatches on the first argument:
.. code-block:: pycon
When called, the function dispatches on the first argument::
>>> fun("Hello, world.")
Hello, world.