diff options
author | Jelle Zijlstra <jelle.zijlstra@gmail.com> | 2023-09-29 02:08:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-29 02:08:04 (GMT) |
commit | 7dc2c5093ef027aab57bca953ac2d6477a4a440b (patch) | |
tree | b0277506d867356ccc983b4abfc4caab59cd5d5d /Doc/library | |
parent | 2e37a38bcbfbe1357436e030538290e7d00b668d (diff) | |
download | cpython-7dc2c5093ef027aab57bca953ac2d6477a4a440b.zip cpython-7dc2c5093ef027aab57bca953ac2d6477a4a440b.tar.gz cpython-7dc2c5093ef027aab57bca953ac2d6477a4a440b.tar.bz2 |
gh-110045: Update symtable module for PEP 695 (#110066)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/symtable.rst | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/Doc/library/symtable.rst b/Doc/library/symtable.rst index 65ff5bf..85eae5f 100644 --- a/Doc/library/symtable.rst +++ b/Doc/library/symtable.rst @@ -38,7 +38,13 @@ Examining Symbol Tables .. method:: get_type() Return the type of the symbol table. Possible values are ``'class'``, - ``'module'``, and ``'function'``. + ``'module'``, ``'function'``, ``'annotation'``, ``'TypeVar bound'``, + ``'type alias'``, and ``'type parameter'``. The latter four refer to + different flavors of :ref:`annotation scopes <annotation-scopes>`. + + .. versionchanged:: 3.12 + Added ``'annotation'``, ``'TypeVar bound'``, ``'type alias'``, + and ``'type parameter'`` as possible return values. .. method:: get_id() @@ -49,6 +55,10 @@ Examining Symbol Tables Return the table's name. This is the name of the class if the table is for a class, the name of the function if the table is for a function, or ``'top'`` if the table is global (:meth:`get_type` returns ``'module'``). + For type parameter scopes (which are used for generic classes, functions, + and type aliases), it is the name of the underlying class, function, or + type alias. For type alias scopes, it is the name of the type alias. + For :class:`~typing.TypeVar` bound scopes, it is the name of the ``TypeVar``. .. method:: get_lineno() |