diff options
author | Benjamin Peterson <benjamin@python.org> | 2014-05-17 20:02:28 -0700 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2014-05-17 20:02:28 -0700 |
commit | 9c7f094fee7e83e4278abb45524089ad02fa59a7 (patch) | |
tree | 5747ccc983dcf3cb8073b041e01ca016a9138b26 /Doc/library/inspect.rst | |
parent | 28fb33a14c81dc44e2bffaa74f8a6106f1d52a92 (diff) | |
parent | dc2d7d21e2018eadd781e865a78fdaec4c25ff39 (diff) | |
download | cpython-9c7f094fee7e83e4278abb45524089ad02fa59a7.tar.gz |
(null merge 3.4)
Diffstat (limited to 'Doc/library/inspect.rst')
-rw-r--r-- | Doc/library/inspect.rst | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 0c087123e8..21408f4664 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -462,6 +462,9 @@ function. Signature objects are *immutable*. Use :meth:`Signature.replace` to make a modified copy. + .. versionchanged:: 3.5 + Signature objects are picklable and hashable. + .. attribute:: Signature.empty A special class-level marker to specify absence of a return annotation. @@ -506,12 +509,29 @@ function. >>> str(new_sig) "(a, b) -> 'new return anno'" + .. classmethod:: Signature.from_callable(obj) + + Return a :class:`Signature` (or its subclass) object for a given callable + ``obj``. This method simplifies subclassing of :class:`Signature`: + + :: + + class MySignature(Signature): + pass + sig = MySignature.from_callable(min) + assert isinstance(sig, MySignature) + + .. versionadded:: 3.5 + .. class:: Parameter(name, kind, \*, default=Parameter.empty, annotation=Parameter.empty) Parameter objects are *immutable*. Instead of modifying a Parameter object, you can use :meth:`Parameter.replace` to create a modified copy. + .. versionchanged:: 3.5 + Parameter objects are picklable and hashable. + .. attribute:: Parameter.empty A special class-level marker to specify absence of default values and |