summaryrefslogtreecommitdiff
path: root/Doc/library/inspect.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/inspect.rst')
-rw-r--r--Doc/library/inspect.rst36
1 files changed, 36 insertions, 0 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst
index 0c087123e8..359f83374a 100644
--- a/Doc/library/inspect.rst
+++ b/Doc/library/inspect.rst
@@ -159,6 +159,16 @@ attributes:
| | | arguments and local |
| | | variables |
+-----------+-----------------+---------------------------+
+| generator | __name__ | name |
++-----------+-----------------+---------------------------+
+| | __qualname__ | qualified name |
++-----------+-----------------+---------------------------+
+| | gi_frame | frame |
++-----------+-----------------+---------------------------+
+| | gi_running | is the generator running? |
++-----------+-----------------+---------------------------+
+| | gi_code | code |
++-----------+-----------------+---------------------------+
| builtin | __doc__ | documentation string |
+-----------+-----------------+---------------------------+
| | __name__ | original name of this |
@@ -169,6 +179,12 @@ attributes:
| | | ``None`` |
+-----------+-----------------+---------------------------+
+.. versionchanged:: 3.5
+
+ Add ``__qualname__`` attribute to generators. The ``__name__`` attribute of
+ generators is now set from the function name, instead of the code name, and
+ it can now be modified.
+
.. function:: getmembers(object[, predicate])
@@ -462,6 +478,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 +525,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