mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
#22613: minor other fixes in library docs (thanks Jacques Ducasse)
This commit is contained in:
parent
2677faecf5
commit
8ed75cd8e9
9 changed files with 35 additions and 30 deletions
|
@ -750,17 +750,20 @@ Classes and functions
|
|||
:func:`getargspec` or :func:`getfullargspec`.
|
||||
|
||||
The first seven arguments are (``args``, ``varargs``, ``varkw``,
|
||||
``defaults``, ``kwonlyargs``, ``kwonlydefaults``, ``annotations``). The
|
||||
other five arguments are the corresponding optional formatting functions
|
||||
that are called to turn names and values into strings. The last argument
|
||||
is an optional function to format the sequence of arguments. For example::
|
||||
``defaults``, ``kwonlyargs``, ``kwonlydefaults``, ``annotations``).
|
||||
|
||||
>>> from inspect import formatargspec, getfullargspec
|
||||
>>> def f(a: int, b: float):
|
||||
... pass
|
||||
...
|
||||
>>> formatargspec(*getfullargspec(f))
|
||||
'(a: int, b: float)'
|
||||
The other six arguments are functions that are called to turn argument names,
|
||||
``*`` argument name, ``**`` argument name, default values, return annotation
|
||||
and individual annotations into strings, respectively.
|
||||
|
||||
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])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue