mirror of https://github.com/flaggo/pydu.git
add doc for functional
This commit is contained in:
parent
6efa2bb6ce
commit
727cb6b415
|
@ -0,0 +1,20 @@
|
||||||
|
Functional
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. py:function:: pydu.functional.compose(*funcs)
|
||||||
|
|
||||||
|
Compose all functions. The previous function must accept one argument,
|
||||||
|
which is the output of the next function. The last function can accept
|
||||||
|
any args and kwargs.
|
||||||
|
|
||||||
|
compose(f1, f2, f3)(*x) is same to f1(f2(f3(*x))).
|
||||||
|
|
||||||
|
>>> from pydu.functional import compose
|
||||||
|
>>> def f1(a):
|
||||||
|
... return a+1
|
||||||
|
...
|
||||||
|
>>> def f2(a, b=2):
|
||||||
|
... return a+b
|
||||||
|
...
|
||||||
|
>>> compose(f1, f2)(1, b=3)
|
||||||
|
5
|
|
@ -28,6 +28,7 @@ Content
|
||||||
dict
|
dict
|
||||||
environ
|
environ
|
||||||
exception
|
exception
|
||||||
|
functional
|
||||||
inspect
|
inspect
|
||||||
iter
|
iter
|
||||||
list
|
list
|
||||||
|
|
Loading…
Reference in New Issue