diff options
author | Dong-hee Na <donghee.na92@gmail.com> | 2018-06-08 03:46:31 (GMT) |
---|---|---|
committer | Yury Selivanov <yury@magic.io> | 2018-06-08 03:46:31 (GMT) |
commit | 4aa3006619392438b0775a2f488bbe9e7a22c468 (patch) | |
tree | 170e855055da5cd7779432234cdb2085a0b5f685 /Doc | |
parent | ee994d7443a7e2809a5d49bd3679fc9c451a411b (diff) | |
download | cpython-4aa3006619392438b0775a2f488bbe9e7a22c468.zip cpython-4aa3006619392438b0775a2f488bbe9e7a22c468.tar.gz cpython-4aa3006619392438b0775a2f488bbe9e7a22c468.tar.bz2 |
bpo-33197: Add description property for _ParameterKind. (GH-7206)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/inspect.rst | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 7db6ca6..37736ef 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -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 |