summaryrefslogtreecommitdiff
path: root/documentation.rst
diff options
context:
space:
mode:
Diffstat (limited to 'documentation.rst')
-rw-r--r--documentation.rst14
1 files changed, 13 insertions, 1 deletions
diff --git a/documentation.rst b/documentation.rst
index 947c707..92a27d4 100644
--- a/documentation.rst
+++ b/documentation.rst
@@ -666,6 +666,19 @@ the names of the mandatory arguments) an attribute ``arg0``, ``arg1``,
..., ``argN`` is also generated. Finally, there is a ``signature``
attribute, a string with the signature of the original function.
+Notice: you should not pass signature strings with default arguments,
+i.e. something like 'f1(a, b=None)'. Just pass 'f1(a, b)' and then
+a tuple of defaults:
+
+.. code-block:: python
+
+ >>> f1 = FunctionMaker.create(
+ ... 'f1(a, b)', 'f(a, b)', dict(f=f), addsource=True, defaults=(None,))
+ >>> import inspect
+ >>> print(inspect.getargspec(f1))
+ ArgSpec(args=['a', 'b'], varargs=None, keywords=None, defaults=(None,))
+
+
Getting the source code
---------------------------------------------------
@@ -694,7 +707,6 @@ source code which is probably not what you want:
.. code-block:: python
- >>> import inspect
>>> print(inspect.getsource(example))
def wrapper(*args, **kw):
return func(*args, **kw)