Skip to content

Commit 4b204a4

Browse files
committed
wording; mention augment
1 parent cef82ca commit 4b204a4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

doc/features.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3021,16 +3021,18 @@ The core idea can be expressed in fewer than 100 lines of Python; ours is (as of
30213021
30223022
*It is now possible to dispatch also on a homogeneous type of contents collected by a `**kwargs` parameter. In the type signature, use `typing.Dict[str, mytype]`. Note that in this use, the key type is always `str`.*
30233023
3024-
The ``generic`` decorator allows creating multiple-dispatch generic functions with type annotation syntax. We also provide some friendly utilities: ``typed`` creates a single-method generic with the same syntax (i.e. provides a compact notation for writing dynamic type checking code), and ``isoftype`` (which powers the first two) is the big sister of ``isinstance``, with support for many (but unfortunately not all) features of the ``typing`` standard library module.
3024+
The ``generic`` decorator allows creating multiple-dispatch generic functions with type annotation syntax. We also provide some friendly utilities: ``augment`` adds a new multimethod to an existing generic function, ``typed`` creates a single-method generic with the same syntax (i.e. provides a compact notation for writing dynamic type checking code), and ``isoftype`` (which powers the first three) is the big sister of ``isinstance``, with support for many (but unfortunately not all) features of the ``typing`` standard library module.
30253025
30263026
For what kind of things can be done with this, see particularly the [*holy traits*](https://ahsmart.com/pub/holy-traits-design-patterns-and-best-practice-book/) example in [`unpythonic.tests.test_dispatch`](../unpythonic/tests/test_dispatch.py).
30273027
30283028
**NOTE**: This was inspired by the [multi-methods of CLOS](http://www.gigamonkeys.com/book/object-reorientation-generic-functions.html) (the Common Lisp Object System), and the [generic functions of Julia](https://docs.julialang.org/en/v1/manual/methods/).
30293029
3030-
In `unpythonic`, we define the terms as follows:
3030+
In `unpythonic`, the terminology is as follows:
30313031
30323032
- The function that supports multiple call signatures is a *generic function*.
3033-
- Its individual implementations are *multimethods*.
3033+
- Each of its individual implementations is a *multimethod*.
3034+
3035+
The term *multimethod* distinguishes them from the OOP sense of *method*, already established in Python, as well as reminds that multiple arguments participate in dispatching.
30343036
30353037
#### ``generic``: multiple dispatch with type annotation syntax
30363038

0 commit comments

Comments
 (0)