summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2014-03-27 16:09:24 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2014-03-27 16:09:24 (GMT)
commitda39645ad300a097decc4e35bb3ea6dbf0633886 (patch)
tree07ccb20f627b8c26a84851df3ebe035d9f0a401c /Doc/library
parenta5d63dd7b880dd38282ad52f52e3579f965b20e0 (diff)
downloadcpython-da39645ad300a097decc4e35bb3ea6dbf0633886.zip
cpython-da39645ad300a097decc4e35bb3ea6dbf0633886.tar.gz
cpython-da39645ad300a097decc4e35bb3ea6dbf0633886.tar.bz2
inspect.Signature: Add 'Signature.from_callable' classmethod. Closes #17373
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/inspect.rst12
1 files changed, 12 insertions, 0 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index 0c08712..85d9593 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -506,6 +506,18 @@ 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)
+
.. class:: Parameter(name, kind, \*, default=Parameter.empty, annotation=Parameter.empty)