mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-33197: Add description property for _ParameterKind. (GH-7206)
This commit is contained in:
parent
ee994d7443
commit
4aa3006619
3 changed files with 25 additions and 6 deletions
|
@ -752,6 +752,23 @@ function.
|
|||
... print('Parameter:', param)
|
||||
Parameter: c
|
||||
|
||||
.. attribute:: Parameter.kind.description
|
||||
|
||||
Describes a enum value of Parameter.kind.
|
||||
|
||||
Example: print all descriptions of arguments::
|
||||
|
||||
>>> def foo(a, b, *, c, d=10):
|
||||
... pass
|
||||
|
||||
>>> sig = signature(foo)
|
||||
>>> for param in sig.parameters.values():
|
||||
... print(param.kind.description)
|
||||
positional or keyword
|
||||
positional or keyword
|
||||
keyword-only
|
||||
keyword-only
|
||||
|
||||
.. method:: Parameter.replace(*[, name][, kind][, default][, annotation])
|
||||
|
||||
Create a new Parameter instance based on the instance replaced was invoked
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue