bpo-33197: Add description property for _ParameterKind. (GH-7206)

This commit is contained in:
Dong-hee Na 2018-06-08 12:46:31 +09:00 committed by Yury Selivanov
parent ee994d7443
commit 4aa3006619
3 changed files with 25 additions and 6 deletions

View file

@ -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