From 39de1a3a6c448fffafa5a8e2f89556821842e5b8 Mon Sep 17 00:00:00 2001 From: Antoine Gallix Date: Wed, 3 Apr 2024 16:51:47 +0200 Subject: [PATCH 1/2] Give example for `caller` The function doc, while being exact, can be hard to read. Giving an example clarifies the function's behavior. --- docs/funcs.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/funcs.rst b/docs/funcs.rst index 8c14e12..1c46de6 100644 --- a/docs/funcs.rst +++ b/docs/funcs.rst @@ -15,6 +15,12 @@ Functions Returns function calling its argument with passed arguments. + apply_operation_to_values = caller([2,4]) + apply_operation_to_values(sum) + # 6 + apply_operation_to_values(math.prod) + # 8 + .. function:: partial(func, *args, **kwargs) From 093aefeb23edabf500b0c3a72ef05b241944b2a3 Mon Sep 17 00:00:00 2001 From: Antoine Gallix Date: Wed, 3 Apr 2024 16:57:08 +0200 Subject: [PATCH 2/2] Fix code block syntax --- docs/funcs.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/funcs.rst b/docs/funcs.rst index 1c46de6..8a90fa9 100644 --- a/docs/funcs.rst +++ b/docs/funcs.rst @@ -13,7 +13,7 @@ Functions .. function:: caller(*args, **kwargs) - Returns function calling its argument with passed arguments. + Returns function calling its argument with passed arguments:: apply_operation_to_values = caller([2,4]) apply_operation_to_values(sum)