Skip to content

Commit

Permalink
Merge pull request #216 from prasunanand/master
Browse files Browse the repository at this point in the history
Update docs
  • Loading branch information
hameerabbasi committed Nov 18, 2019
2 parents 39046d6 + 3e58ebc commit fff35f3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/libauthor_docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ functions provided by other backends. This is the purpose of the
The process that takes place when the backend is tried
------------------------------------------------------

First of all, the backend's ``__ua_convert__`` method is tried. If it does not return
First of all, the backend's ``__ua_convert__`` method is tried. If it returns
:obj:`NotImplemented`, then the backend's ``__ua_function__`` protocol is tried. If a
value other than :obj:`NotImplemented` is returned, it is assumed to be the final
return value. Any exceptions raised are propagated up the call stack.

Examples
--------

Examples for library authors can be found `in the source of unumpy.numpy_backend <https://github.com/Quansight-Labs/uarray/blob/master/unumpy/numpy_backend.py>`_
and other ``*_backend.py`` files in `this directory <https://github.com/Quansight-Labs/uarray/tree/master/unumpy>`_.
Examples for library authors can be found `in the source of unumpy.numpy_backend <https://github.com/Quansight-Labs/unumpy/blob/master/unumpy/numpy_backend.py>`_
and other ``*_backend.py`` files in `this directory <https://github.com/Quansight-Labs/unumpy/tree/master/unumpy>`_.
7 changes: 4 additions & 3 deletions docs/multimethod_docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,14 @@ Argument replacer

The argument replacer takes in the arguments and dispatchable arguments, and
its job is to replace the arguments previously extracted by the argument
extractor by by other arguments provided in the list. Therefore, the
extractor by other arguments provided in the list. Therefore, the
signature of this function is ``(args, kwargs, dispatchable_args)``,
and it returns an ``args``/``kwargs`` pair. We realise this is a hard problem
in general, so we have provided a few simplifications, such as that the
default-valued keyword arguments will be removed from the list.

We recommend following the pattern in `here <https://github.com/Quansight-Labs/uarray/blob/master/unumpy/multimethods.py>`_

We recommend following the pattern in `here <https://github.com/Quansight-Labs/unumpy/blob/master/unumpy/multimethods.py>`_
for optimal operation: passing the ``args``/``kwargs`` into a function with a
similar signature and then return the modified ``args``/``kwargs``.

Expand All @@ -69,7 +70,7 @@ downstream multimethods is not defined.
Examples
--------

Examples of writing multimethods are found in `this file <https://github.com/Quansight-Labs/uarray/blob/master/unumpy/multimethods.py>`_.
Examples of writing multimethods are found in `this file <https://github.com/Quansight-Labs/unumpy/blob/master/unumpy/_multimethods.py>`_.
It also teaches some advanced techniques, such as overriding instance methods,
including ``__call__``. The same philosophy may be used to override properties,
static methods and class methods.
3 changes: 2 additions & 1 deletion uarray/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
multimethods, and implementors to override them. But, as is often the case,
similar people write both.
Without further ado, here's an example multimethTrueod:
Without further ado, here's an example multimethod:
>>> import uarray as ua
>>> from uarray import Dispatchable
>>> def override_me(a, b):
... return Dispatchable(a, int),
>>> def override_replacer(args, kwargs, dispatchables):
Expand Down

0 comments on commit fff35f3

Please sign in to comment.