Kaydet (Commit) 735d3172 authored tarafından Andrew Svetlov's avatar Andrew Svetlov

Issue #16243: add example for inspect.formatargspec

Patch by Berker Peksag.
üst 6a65bcdf
...@@ -716,7 +716,7 @@ Classes and functions ...@@ -716,7 +716,7 @@ Classes and functions
locals dictionary of the given frame. locals dictionary of the given frame.
.. function:: formatargspec(args[, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations, formatarg, formatvarargs, formatvarkw, formatvalue, formatreturns, formatannotations]) .. function:: formatargspec(args[, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations[, formatarg, formatvarargs, formatvarkw, formatvalue, formatreturns, formatannotations]])
Format a pretty argument spec from the values returned by Format a pretty argument spec from the values returned by
:func:`getargspec` or :func:`getfullargspec`. :func:`getargspec` or :func:`getfullargspec`.
...@@ -725,7 +725,14 @@ Classes and functions ...@@ -725,7 +725,14 @@ Classes and functions
``defaults``, ``kwonlyargs``, ``kwonlydefaults``, ``annotations``). The ``defaults``, ``kwonlyargs``, ``kwonlydefaults``, ``annotations``). The
other five arguments are the corresponding optional formatting functions other five arguments are the corresponding optional formatting functions
that are called to turn names and values into strings. The last argument that are called to turn names and values into strings. The last argument
is an optional function to format the sequence of arguments. is an optional function to format the sequence of arguments. For example::
>>> from inspect import formatargspec, getfullargspec
>>> def f(a: int, b: float):
... pass
...
>>> formatargspec(*getfullargspec(f))
'(a: int, b: float)'
.. function:: formatargvalues(args[, varargs, varkw, locals, formatarg, formatvarargs, formatvarkw, formatvalue]) .. function:: formatargvalues(args[, varargs, varkw, locals, formatarg, formatvarargs, formatvarkw, formatvalue])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment