mirror of
https://github.com/python/cpython.git
synced 2025-08-07 02:18:59 +00:00
Python 3.12.2
This commit is contained in:
parent
831b95d9b9
commit
6abddd9f6a
109 changed files with 1455 additions and 530 deletions
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Autogenerated by Sphinx on Thu Dec 7 21:32:35 2023
|
||||
# Autogenerated by Sphinx on Tue Feb 6 21:16:37 2024
|
||||
# as part of the release process.
|
||||
topics = {'assert': 'The "assert" statement\n'
|
||||
'**********************\n'
|
||||
|
@ -3058,8 +3058,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'standard\n'
|
||||
'Python grammar. Triple-quoted strings are supported. Raw '
|
||||
'strings and\n'
|
||||
'byte strings are supported. Formatted string literals are not\n'
|
||||
'supported.\n'
|
||||
'byte strings are supported. f-strings are not supported.\n'
|
||||
'\n'
|
||||
'The forms "signed_number \'+\' NUMBER" and "signed_number \'-\' '
|
||||
'NUMBER"\n'
|
||||
|
@ -3713,7 +3712,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' **PEP 526** - Syntax for Variable Annotations\n'
|
||||
' Ability to type hint variable declarations, including '
|
||||
'class\n'
|
||||
' variables and instance variables\n'
|
||||
' variables and instance variables.\n'
|
||||
'\n'
|
||||
' **PEP 563** - Postponed Evaluation of Annotations\n'
|
||||
' Support for forward references within annotations by '
|
||||
|
@ -3721,6 +3720,11 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' annotations in a string form at runtime instead of eager\n'
|
||||
' evaluation.\n'
|
||||
'\n'
|
||||
' **PEP 318** - Decorators for Functions and Methods\n'
|
||||
' Function and method decorators were introduced. Class '
|
||||
'decorators\n'
|
||||
' were introduced in **PEP 3129**.\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Class definitions\n'
|
||||
'=================\n'
|
||||
|
@ -4837,8 +4841,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'denial-of-service caused\n'
|
||||
' by carefully chosen inputs that exploit the worst '
|
||||
'case\n'
|
||||
' performance of a dict insertion, O(n^2) complexity. '
|
||||
'See\n'
|
||||
' performance of a dict insertion, *O*(*n*^2) '
|
||||
'complexity. See\n'
|
||||
' http://ocert.org/advisories/ocert-2011-003.html for\n'
|
||||
' details.Changing hash values affects the iteration '
|
||||
'order of sets.\n'
|
||||
|
@ -4917,7 +4921,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'and continue running without the debugger using the "continue"\n'
|
||||
'command.\n'
|
||||
'\n'
|
||||
'New in version 3.7: The built-in "breakpoint()", when called '
|
||||
'Changed in version 3.7: The built-in "breakpoint()", when called '
|
||||
'with\n'
|
||||
'defaults, can be used instead of "import pdb; pdb.set_trace()".\n'
|
||||
'\n'
|
||||
|
@ -4961,11 +4965,11 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'the\n'
|
||||
'debugger upon program’s exit.\n'
|
||||
'\n'
|
||||
'New in version 3.2: "-c" option is introduced to execute '
|
||||
'Changed in version 3.2: Added the "-c" option to execute '
|
||||
'commands as\n'
|
||||
'if given in a ".pdbrc" file, see Debugger Commands.\n'
|
||||
'if given in a ".pdbrc" file; see Debugger Commands.\n'
|
||||
'\n'
|
||||
'New in version 3.7: "-m" option is introduced to execute '
|
||||
'Changed in version 3.7: Added the "-m" option to execute '
|
||||
'modules\n'
|
||||
'similar to the way "python -m" does. As with a script, the '
|
||||
'debugger\n'
|
||||
|
@ -5111,11 +5115,11 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' Raises an auditing event "pdb.Pdb" with no arguments.\n'
|
||||
'\n'
|
||||
' New in version 3.1: The *skip* argument.\n'
|
||||
' Changed in version 3.1: Added the *skip* parameter.\n'
|
||||
'\n'
|
||||
' New in version 3.2: The *nosigint* argument. Previously, a '
|
||||
'SIGINT\n'
|
||||
' handler was never set by Pdb.\n'
|
||||
' Changed in version 3.2: Added the *nosigint* parameter. '
|
||||
'Previously,\n'
|
||||
' a SIGINT handler was never set by Pdb.\n'
|
||||
'\n'
|
||||
' Changed in version 3.6: The *readrc* argument.\n'
|
||||
'\n'
|
||||
|
@ -5458,7 +5462,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'differs\n'
|
||||
' from the current line.\n'
|
||||
'\n'
|
||||
' New in version 3.2: The ">>" marker.\n'
|
||||
' Changed in version 3.2: Added the ">>" marker.\n'
|
||||
'\n'
|
||||
'll | longlist\n'
|
||||
'\n'
|
||||
|
@ -6390,15 +6394,15 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'originally\n'
|
||||
'proposed by **PEP 448**.\n'
|
||||
'\n'
|
||||
'The trailing comma is required only to create a single tuple '
|
||||
'(a.k.a. a\n'
|
||||
'*singleton*); it is optional in all other cases. A single '
|
||||
'expression\n'
|
||||
'without a trailing comma doesn’t create a tuple, but rather '
|
||||
'yields the\n'
|
||||
'value of that expression. (To create an empty tuple, use an '
|
||||
'empty pair\n'
|
||||
'of parentheses: "()".)\n',
|
||||
'A trailing comma is required only to create a one-item tuple, '
|
||||
'such as\n'
|
||||
'"1,"; it is optional in all other cases. A single expression '
|
||||
'without a\n'
|
||||
'trailing comma doesn’t create a tuple, but rather yields the '
|
||||
'value of\n'
|
||||
'that expression. (To create an empty tuple, use an empty pair '
|
||||
'of\n'
|
||||
'parentheses: "()".)\n',
|
||||
'floating': 'Floating point literals\n'
|
||||
'***********************\n'
|
||||
'\n'
|
||||
|
@ -6512,7 +6516,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' index_string ::= <any source character except "]"> '
|
||||
'+\n'
|
||||
' conversion ::= "r" | "s" | "a"\n'
|
||||
' format_spec ::= <described in the next section>\n'
|
||||
' format_spec ::= format-spec:format_spec\n'
|
||||
'\n'
|
||||
'In less formal terms, the replacement field can start with '
|
||||
'a\n'
|
||||
|
@ -6647,12 +6651,11 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'contained\n'
|
||||
'within a format string to define how individual values are '
|
||||
'presented\n'
|
||||
'(see Format String Syntax and Formatted string literals). '
|
||||
'They can\n'
|
||||
'also be passed directly to the built-in "format()" '
|
||||
'function. Each\n'
|
||||
'formattable type may define how the format specification is '
|
||||
'to be\n'
|
||||
'(see Format String Syntax and f-strings). They can also be '
|
||||
'passed\n'
|
||||
'directly to the built-in "format()" function. Each '
|
||||
'formattable type\n'
|
||||
'may define how the format specification is to be '
|
||||
'interpreted.\n'
|
||||
'\n'
|
||||
'Most built-in types implement the following options for '
|
||||
|
@ -7467,13 +7470,18 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' **PEP 526** - Syntax for Variable Annotations\n'
|
||||
' Ability to type hint variable declarations, including '
|
||||
'class\n'
|
||||
' variables and instance variables\n'
|
||||
' variables and instance variables.\n'
|
||||
'\n'
|
||||
' **PEP 563** - Postponed Evaluation of Annotations\n'
|
||||
' Support for forward references within annotations by '
|
||||
'preserving\n'
|
||||
' annotations in a string form at runtime instead of eager\n'
|
||||
' evaluation.\n',
|
||||
' evaluation.\n'
|
||||
'\n'
|
||||
' **PEP 318** - Decorators for Functions and Methods\n'
|
||||
' Function and method decorators were introduced. Class '
|
||||
'decorators\n'
|
||||
' were introduced in **PEP 3129**.\n',
|
||||
'global': 'The "global" statement\n'
|
||||
'**********************\n'
|
||||
'\n'
|
||||
|
@ -9170,15 +9178,13 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'A traceback object is normally created automatically when an '
|
||||
'exception\n'
|
||||
'is raised and attached to it as the "__traceback__" attribute, '
|
||||
'which\n'
|
||||
'is writable. You can create an exception and set your own traceback '
|
||||
'in\n'
|
||||
'one step using the "with_traceback()" exception method (which '
|
||||
'returns\n'
|
||||
'the same exception instance, with its traceback set to its '
|
||||
'argument),\n'
|
||||
'like so:\n'
|
||||
'is raised and attached to it as the "__traceback__" attribute. You '
|
||||
'can\n'
|
||||
'create an exception and set your own traceback in one step using '
|
||||
'the\n'
|
||||
'"with_traceback()" exception method (which returns the same '
|
||||
'exception\n'
|
||||
'instance, with its traceback set to its argument), like so:\n'
|
||||
'\n'
|
||||
' raise Exception("foo occurred").with_traceback(tracebackobj)\n'
|
||||
'\n'
|
||||
|
@ -9204,6 +9210,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' ...\n'
|
||||
' Traceback (most recent call last):\n'
|
||||
' File "<stdin>", line 2, in <module>\n'
|
||||
' print(1 / 0)\n'
|
||||
' ~~^~~\n'
|
||||
' ZeroDivisionError: division by zero\n'
|
||||
'\n'
|
||||
' The above exception was the direct cause of the following '
|
||||
|
@ -9211,6 +9219,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' Traceback (most recent call last):\n'
|
||||
' File "<stdin>", line 4, in <module>\n'
|
||||
' raise RuntimeError("Something bad happened") from exc\n'
|
||||
' RuntimeError: Something bad happened\n'
|
||||
'\n'
|
||||
'A similar mechanism works implicitly if a new exception is raised '
|
||||
|
@ -9229,6 +9238,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' ...\n'
|
||||
' Traceback (most recent call last):\n'
|
||||
' File "<stdin>", line 2, in <module>\n'
|
||||
' print(1 / 0)\n'
|
||||
' ~~^~~\n'
|
||||
' ZeroDivisionError: division by zero\n'
|
||||
'\n'
|
||||
' During handling of the above exception, another exception '
|
||||
|
@ -9236,6 +9247,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' Traceback (most recent call last):\n'
|
||||
' File "<stdin>", line 4, in <module>\n'
|
||||
' raise RuntimeError("Something bad happened")\n'
|
||||
' RuntimeError: Something bad happened\n'
|
||||
'\n'
|
||||
'Exception chaining can be explicitly suppressed by specifying '
|
||||
|
@ -9424,23 +9436,20 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' Called to implement evaluation of "self[key]". For '
|
||||
'*sequence*\n'
|
||||
' types, the accepted keys should be integers and slice '
|
||||
'objects.\n'
|
||||
' Note that the special interpretation of negative '
|
||||
'indexes (if the\n'
|
||||
' class wishes to emulate a *sequence* type) is up to '
|
||||
'the\n'
|
||||
' "__getitem__()" method. If *key* is of an inappropriate '
|
||||
'type,\n'
|
||||
' "TypeError" may be raised; if of a value outside the '
|
||||
'set of indexes\n'
|
||||
' for the sequence (after any special interpretation of '
|
||||
'negative\n'
|
||||
' values), "IndexError" should be raised. For *mapping* '
|
||||
'types, if\n'
|
||||
' *key* is missing (not in the container), "KeyError" '
|
||||
'should be\n'
|
||||
' raised.\n'
|
||||
' types, the accepted keys should be integers. '
|
||||
'Optionally, they may\n'
|
||||
' support "slice" objects as well. Negative index '
|
||||
'support is also\n'
|
||||
' optional. If *key* is of an inappropriate type, '
|
||||
'"TypeError" may be\n'
|
||||
' raised; if *key* is a value outside the set of indexes '
|
||||
'for the\n'
|
||||
' sequence (after any special interpretation of negative '
|
||||
'values),\n'
|
||||
' "IndexError" should be raised. For *mapping* types, if '
|
||||
'*key* is\n'
|
||||
' missing (not in the container), "KeyError" should be '
|
||||
'raised.\n'
|
||||
'\n'
|
||||
' Note:\n'
|
||||
'\n'
|
||||
|
@ -10162,8 +10171,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' intended to provide protection against a '
|
||||
'denial-of-service caused\n'
|
||||
' by carefully chosen inputs that exploit the worst case\n'
|
||||
' performance of a dict insertion, O(n^2) complexity. '
|
||||
'See\n'
|
||||
' performance of a dict insertion, *O*(*n*^2) '
|
||||
'complexity. See\n'
|
||||
' http://ocert.org/advisories/ocert-2011-003.html for\n'
|
||||
' details.Changing hash values affects the iteration '
|
||||
'order of sets.\n'
|
||||
|
@ -10706,7 +10715,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' Keyword arguments which are given to a new class are '
|
||||
'passed to the\n'
|
||||
' parent’s class "__init_subclass__". For compatibility '
|
||||
' parent class’s "__init_subclass__". For compatibility '
|
||||
'with other\n'
|
||||
' classes using "__init_subclass__", one should take out '
|
||||
'the needed\n'
|
||||
|
@ -11393,22 +11402,20 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' Called to implement evaluation of "self[key]". For '
|
||||
'*sequence*\n'
|
||||
' types, the accepted keys should be integers and slice '
|
||||
'objects.\n'
|
||||
' Note that the special interpretation of negative indexes '
|
||||
'(if the\n'
|
||||
' class wishes to emulate a *sequence* type) is up to the\n'
|
||||
' "__getitem__()" method. If *key* is of an inappropriate '
|
||||
'type,\n'
|
||||
' "TypeError" may be raised; if of a value outside the set '
|
||||
'of indexes\n'
|
||||
' for the sequence (after any special interpretation of '
|
||||
'negative\n'
|
||||
' values), "IndexError" should be raised. For *mapping* '
|
||||
'types, if\n'
|
||||
' *key* is missing (not in the container), "KeyError" '
|
||||
'should be\n'
|
||||
' raised.\n'
|
||||
' types, the accepted keys should be integers. Optionally, '
|
||||
'they may\n'
|
||||
' support "slice" objects as well. Negative index support '
|
||||
'is also\n'
|
||||
' optional. If *key* is of an inappropriate type, '
|
||||
'"TypeError" may be\n'
|
||||
' raised; if *key* is a value outside the set of indexes '
|
||||
'for the\n'
|
||||
' sequence (after any special interpretation of negative '
|
||||
'values),\n'
|
||||
' "IndexError" should be raised. For *mapping* types, if '
|
||||
'*key* is\n'
|
||||
' missing (not in the container), "KeyError" should be '
|
||||
'raised.\n'
|
||||
'\n'
|
||||
' Note:\n'
|
||||
'\n'
|
||||
|
@ -13001,12 +13008,11 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'A string literal with "\'f\'" or "\'F\'" in its prefix is a '
|
||||
'*formatted\n'
|
||||
'string literal*; see Formatted string literals. The "\'f\'" may '
|
||||
'be\n'
|
||||
'combined with "\'r\'", but not with "\'b\'" or "\'u\'", therefore '
|
||||
'raw\n'
|
||||
'formatted strings are possible, but formatted bytes literals are '
|
||||
'not.\n'
|
||||
'string literal*; see f-strings. The "\'f\'" may be combined with '
|
||||
'"\'r\'",\n'
|
||||
'but not with "\'b\'" or "\'u\'", therefore raw formatted strings '
|
||||
'are\n'
|
||||
'possible, but formatted bytes literals are not.\n'
|
||||
'\n'
|
||||
'In triple-quoted literals, unescaped newlines and quotes are '
|
||||
'allowed\n'
|
||||
|
@ -13910,130 +13916,117 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'function’s\n'
|
||||
'formal parameter list.\n'
|
||||
'\n'
|
||||
'Special attributes:\n'
|
||||
'\n'
|
||||
'+---------------------------+---------------------------------+-------------+\n'
|
||||
'| Attribute | Meaning '
|
||||
'| |\n'
|
||||
'|===========================|=================================|=============|\n'
|
||||
'| "__doc__" | The function’s documentation | '
|
||||
'Writable |\n'
|
||||
'| | string, or "None" if '
|
||||
'| |\n'
|
||||
'| | unavailable; not inherited by '
|
||||
'| |\n'
|
||||
'| | subclasses. '
|
||||
'| |\n'
|
||||
'+---------------------------+---------------------------------+-------------+\n'
|
||||
'| "__name__" | The function’s name. | '
|
||||
'Writable |\n'
|
||||
'+---------------------------+---------------------------------+-------------+\n'
|
||||
'| "__qualname__" | The function’s *qualified | '
|
||||
'Writable |\n'
|
||||
'| | name*. New in version 3.3. '
|
||||
'| |\n'
|
||||
'+---------------------------+---------------------------------+-------------+\n'
|
||||
'| "__module__" | The name of the module the | '
|
||||
'Writable |\n'
|
||||
'| | function was defined in, or '
|
||||
'| |\n'
|
||||
'| | "None" if unavailable. '
|
||||
'| |\n'
|
||||
'+---------------------------+---------------------------------+-------------+\n'
|
||||
'| "__defaults__" | A tuple containing default | '
|
||||
'Writable |\n'
|
||||
'| | argument values for those '
|
||||
'| |\n'
|
||||
'| | arguments that have defaults, '
|
||||
'| |\n'
|
||||
'| | or "None" if no arguments have '
|
||||
'| |\n'
|
||||
'| | a default value. '
|
||||
'| |\n'
|
||||
'+---------------------------+---------------------------------+-------------+\n'
|
||||
'| "__code__" | The code object representing | '
|
||||
'Writable |\n'
|
||||
'| | the compiled function body. '
|
||||
'| |\n'
|
||||
'+---------------------------+---------------------------------+-------------+\n'
|
||||
'| "__globals__" | A reference to the dictionary | '
|
||||
'Read-only |\n'
|
||||
'| | that holds the function’s '
|
||||
'| |\n'
|
||||
'| | global variables — the global '
|
||||
'| |\n'
|
||||
'| | namespace of the module in '
|
||||
'| |\n'
|
||||
'| | which the function was defined. '
|
||||
'| |\n'
|
||||
'+---------------------------+---------------------------------+-------------+\n'
|
||||
'| "__dict__" | The namespace supporting | '
|
||||
'Writable |\n'
|
||||
'| | arbitrary function attributes. '
|
||||
'| |\n'
|
||||
'+---------------------------+---------------------------------+-------------+\n'
|
||||
'| "__closure__" | "None" or a tuple of cells that | '
|
||||
'Read-only |\n'
|
||||
'| | contain bindings for the '
|
||||
'| |\n'
|
||||
'| | function’s free variables. See '
|
||||
'| |\n'
|
||||
'| | below for information on the '
|
||||
'| |\n'
|
||||
'| | "cell_contents" attribute. '
|
||||
'| |\n'
|
||||
'+---------------------------+---------------------------------+-------------+\n'
|
||||
'| "__annotations__" | A dict containing annotations | '
|
||||
'Writable |\n'
|
||||
'| | of parameters. The keys of the '
|
||||
'| |\n'
|
||||
'| | dict are the parameter names, '
|
||||
'| |\n'
|
||||
'| | and "\'return\'" for the return '
|
||||
'| |\n'
|
||||
'| | annotation, if provided. For '
|
||||
'| |\n'
|
||||
'| | more information on working '
|
||||
'| |\n'
|
||||
'| | with this attribute, see '
|
||||
'| |\n'
|
||||
'| | Annotations Best Practices. '
|
||||
'| |\n'
|
||||
'+---------------------------+---------------------------------+-------------+\n'
|
||||
'| "__kwdefaults__" | A dict containing defaults for | '
|
||||
'Writable |\n'
|
||||
'| | keyword-only parameters. '
|
||||
'| |\n'
|
||||
'+---------------------------+---------------------------------+-------------+\n'
|
||||
'| "__type_params__" | A tuple containing the type | '
|
||||
'Writable |\n'
|
||||
'| | parameters of a generic '
|
||||
'| |\n'
|
||||
'| | function. '
|
||||
'| |\n'
|
||||
'+---------------------------+---------------------------------+-------------+\n'
|
||||
'Special read-only attributes\n'
|
||||
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
|
||||
'\n'
|
||||
'Most of the attributes labelled “Writable” check the type of the\n'
|
||||
'assigned value.\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| Attribute | '
|
||||
'Meaning |\n'
|
||||
'|====================================================|====================================================|\n'
|
||||
'| function.__globals__ | A reference '
|
||||
'to the "dictionary" that holds the |\n'
|
||||
'| | function’s '
|
||||
'global variables – the global namespace |\n'
|
||||
'| | of the '
|
||||
'module in which the function was defined. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| function.__closure__ | "None" or a '
|
||||
'"tuple" of cells that contain bindings |\n'
|
||||
'| | for the '
|
||||
'function’s free variables. A cell object |\n'
|
||||
'| | has the '
|
||||
'attribute "cell_contents". This can be |\n'
|
||||
'| | used to get '
|
||||
'the value of the cell, as well as set |\n'
|
||||
'| | the '
|
||||
'value. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Special writable attributes\n'
|
||||
'~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
|
||||
'\n'
|
||||
'Most of these attributes check the type of the assigned value:\n'
|
||||
'\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| Attribute | '
|
||||
'Meaning |\n'
|
||||
'|====================================================|====================================================|\n'
|
||||
'| function.__doc__ | The '
|
||||
'function’s documentation string, or "None" if |\n'
|
||||
'| | unavailable. '
|
||||
'Not inherited by subclasses. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| function.__name__ | The '
|
||||
'function’s name. See also: "__name__ |\n'
|
||||
'| | '
|
||||
'attributes". |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| function.__qualname__ | The '
|
||||
'function’s *qualified name*. See also: |\n'
|
||||
'| | '
|
||||
'"__qualname__ attributes". New in version 3.3. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| function.__module__ | The name of '
|
||||
'the module the function was defined |\n'
|
||||
'| | in, or '
|
||||
'"None" if unavailable. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| function.__defaults__ | A "tuple" '
|
||||
'containing default *parameter* values |\n'
|
||||
'| | for those '
|
||||
'parameters that have defaults, or "None" |\n'
|
||||
'| | if no '
|
||||
'parameters have a default value. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| function.__code__ | The code '
|
||||
'object representing the compiled function |\n'
|
||||
'| | '
|
||||
'body. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| function.__dict__ | The '
|
||||
'namespace supporting arbitrary function |\n'
|
||||
'| | attributes. '
|
||||
'See also: "__dict__ attributes". |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| function.__annotations__ | A '
|
||||
'"dictionary" containing annotations of |\n'
|
||||
'| | '
|
||||
'*parameters*. The keys of the dictionary are the |\n'
|
||||
'| | parameter '
|
||||
'names, and "\'return\'" for the return |\n'
|
||||
'| | annotation, '
|
||||
'if provided. See also: Annotations |\n'
|
||||
'| | Best '
|
||||
'Practices. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| function.__kwdefaults__ | A '
|
||||
'"dictionary" containing defaults for keyword- |\n'
|
||||
'| | only '
|
||||
'*parameters*. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| function.__type_params__ | A "tuple" '
|
||||
'containing the type parameters of a |\n'
|
||||
'| | generic '
|
||||
'function. New in version 3.12. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'\n'
|
||||
'Function objects also support getting and setting arbitrary\n'
|
||||
'attributes, which can be used, for example, to attach metadata to\n'
|
||||
'functions. Regular attribute dot-notation is used to get and set '
|
||||
'such\n'
|
||||
'attributes. *Note that the current implementation only supports\n'
|
||||
'function attributes on user-defined functions. Function attributes '
|
||||
'on\n'
|
||||
'built-in functions may be supported in the future.*\n'
|
||||
'attributes.\n'
|
||||
'\n'
|
||||
'A cell object has the attribute "cell_contents". This can be used '
|
||||
'to\n'
|
||||
'get the value of the cell, as well as set the value.\n'
|
||||
'**CPython implementation detail:** CPython’s current '
|
||||
'implementation\n'
|
||||
'only supports function attributes on user-defined functions. '
|
||||
'Function\n'
|
||||
'attributes on built-in functions may be supported in the future.\n'
|
||||
'\n'
|
||||
'Additional information about a function’s definition can be '
|
||||
'retrieved\n'
|
||||
'from its code object; see the description of internal types below. '
|
||||
'The\n'
|
||||
'"cell" type can be accessed in the "types" module.\n'
|
||||
'from its code object (accessible via the "__code__" attribute).\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Instance methods\n'
|
||||
|
@ -14043,14 +14036,34 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'any\n'
|
||||
'callable object (normally a user-defined function).\n'
|
||||
'\n'
|
||||
'Special read-only attributes: "__self__" is the class instance '
|
||||
'object,\n'
|
||||
'"__func__" is the function object; "__doc__" is the method’s\n'
|
||||
'documentation (same as "__func__.__doc__"); "__name__" is the '
|
||||
'method\n'
|
||||
'name (same as "__func__.__name__"); "__module__" is the name of '
|
||||
'the\n'
|
||||
'module the method was defined in, or "None" if unavailable.\n'
|
||||
'Special read-only attributes:\n'
|
||||
'\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| method.__self__ | Refers to '
|
||||
'the class instance object to which the |\n'
|
||||
'| | method is '
|
||||
'bound |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| method.__func__ | Refers to '
|
||||
'the original function object |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| method.__doc__ | The method’s '
|
||||
'documentation (same as |\n'
|
||||
'| | '
|
||||
'"method.__func__.__doc__"). A "string" if the |\n'
|
||||
'| | original '
|
||||
'function had a docstring, else "None". |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| method.__name__ | The name of '
|
||||
'the method (same as |\n'
|
||||
'| | '
|
||||
'"method.__func__.__name__") |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| method.__module__ | The name of '
|
||||
'the module the method was defined in, |\n'
|
||||
'| | or "None" if '
|
||||
'unavailable. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'\n'
|
||||
'Methods also support accessing (but not setting) the arbitrary\n'
|
||||
'function attributes on the underlying function object.\n'
|
||||
|
@ -14059,24 +14072,20 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'attribute\n'
|
||||
'of a class (perhaps via an instance of that class), if that '
|
||||
'attribute\n'
|
||||
'is a user-defined function object or a class method object.\n'
|
||||
'is a user-defined function object or a "classmethod" object.\n'
|
||||
'\n'
|
||||
'When an instance method object is created by retrieving a '
|
||||
'user-defined\n'
|
||||
'function object from a class via one of its instances, its '
|
||||
'"__self__"\n'
|
||||
'attribute is the instance, and the method object is said to be '
|
||||
'bound.\n'
|
||||
'The new method’s "__func__" attribute is the original function '
|
||||
'object.\n'
|
||||
'attribute is the instance, and the method object is said to be\n'
|
||||
'*bound*. The new method’s "__func__" attribute is the original\n'
|
||||
'function object.\n'
|
||||
'\n'
|
||||
'When an instance method object is created by retrieving a class '
|
||||
'method\n'
|
||||
'object from a class or instance, its "__self__" attribute is the '
|
||||
'class\n'
|
||||
'itself, and its "__func__" attribute is the function object '
|
||||
'underlying\n'
|
||||
'the class method.\n'
|
||||
'When an instance method object is created by retrieving a\n'
|
||||
'"classmethod" object from a class or instance, its "__self__"\n'
|
||||
'attribute is the class itself, and its "__func__" attribute is the\n'
|
||||
'function object underlying the class method.\n'
|
||||
'\n'
|
||||
'When an instance method object is called, the underlying function\n'
|
||||
'("__func__") is called, inserting the class instance ("__self__") '
|
||||
|
@ -14087,7 +14096,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'of\n'
|
||||
'"C", calling "x.f(1)" is equivalent to calling "C.f(x, 1)".\n'
|
||||
'\n'
|
||||
'When an instance method object is derived from a class method '
|
||||
'When an instance method object is derived from a "classmethod" '
|
||||
'object,\n'
|
||||
'the “class instance” stored in "__self__" will actually be the '
|
||||
'class\n'
|
||||
|
@ -14175,13 +14184,18 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'of built-in functions are "len()" and "math.sin()" ("math" is a\n'
|
||||
'standard built-in module). The number and type of the arguments '
|
||||
'are\n'
|
||||
'determined by the C function. Special read-only attributes: '
|
||||
'"__doc__"\n'
|
||||
'is the function’s documentation string, or "None" if unavailable;\n'
|
||||
'"__name__" is the function’s name; "__self__" is set to "None" '
|
||||
'(but\n'
|
||||
'see the next item); "__module__" is the name of the module the\n'
|
||||
'function was defined in or "None" if unavailable.\n'
|
||||
'determined by the C function. Special read-only attributes:\n'
|
||||
'\n'
|
||||
'* "__doc__" is the function’s documentation string, or "None" if\n'
|
||||
' unavailable. See "function.__doc__".\n'
|
||||
'\n'
|
||||
'* "__name__" is the function’s name. See "function.__name__".\n'
|
||||
'\n'
|
||||
'* "__self__" is set to "None" (but see the next item).\n'
|
||||
'\n'
|
||||
'* "__module__" is the name of the module the function was defined '
|
||||
'in\n'
|
||||
' or "None" if unavailable. See "function.__module__".\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Built-in methods\n'
|
||||
|
@ -14193,7 +14207,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'argument. An example of a built-in method is "alist.append()",\n'
|
||||
'assuming *alist* is a list object. In this case, the special '
|
||||
'read-only\n'
|
||||
'attribute "__self__" is set to the object denoted by *alist*.\n'
|
||||
'attribute "__self__" is set to the object denoted by *alist*. (The\n'
|
||||
'attribute has the same semantics as it does with "other instance\n'
|
||||
'methods".)\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Classes\n'
|
||||
|
@ -14225,16 +14241,15 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'statement, or by calling functions such as '
|
||||
'"importlib.import_module()"\n'
|
||||
'and built-in "__import__()". A module object has a namespace\n'
|
||||
'implemented by a dictionary object (this is the dictionary '
|
||||
'referenced\n'
|
||||
'by the "__globals__" attribute of functions defined in the '
|
||||
'module).\n'
|
||||
'Attribute references are translated to lookups in this dictionary,\n'
|
||||
'e.g., "m.x" is equivalent to "m.__dict__["x"]". A module object '
|
||||
'does\n'
|
||||
'not contain the code object used to initialize the module (since '
|
||||
'it\n'
|
||||
'isn’t needed once the initialization is done).\n'
|
||||
'implemented by a "dictionary" object (this is the dictionary\n'
|
||||
'referenced by the "__globals__" attribute of functions defined in '
|
||||
'the\n'
|
||||
'module). Attribute references are translated to lookups in this\n'
|
||||
'dictionary, e.g., "m.x" is equivalent to "m.__dict__["x"]". A '
|
||||
'module\n'
|
||||
'object does not contain the code object used to initialize the '
|
||||
'module\n'
|
||||
'(since it isn’t needed once the initialization is done).\n'
|
||||
'\n'
|
||||
'Attribute assignment updates the module’s namespace dictionary, '
|
||||
'e.g.,\n'
|
||||
|
@ -14308,14 +14323,13 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'a\n'
|
||||
'class method object, it is transformed into an instance method '
|
||||
'object\n'
|
||||
'whose "__self__" attribute is "C". When it would yield a static\n'
|
||||
'method object, it is transformed into the object wrapped by the '
|
||||
'static\n'
|
||||
'method object. See section Implementing Descriptors for another way '
|
||||
'in\n'
|
||||
'which attributes retrieved from a class may differ from those '
|
||||
'actually\n'
|
||||
'contained in its "__dict__".\n'
|
||||
'whose "__self__" attribute is "C". When it would yield a\n'
|
||||
'"staticmethod" object, it is transformed into the object wrapped '
|
||||
'by\n'
|
||||
'the static method object. See section Implementing Descriptors for\n'
|
||||
'another way in which attributes retrieved from a class may differ '
|
||||
'from\n'
|
||||
'those actually contained in its "__dict__".\n'
|
||||
'\n'
|
||||
'Class attribute assignments update the class’s dictionary, never '
|
||||
'the\n'
|
||||
|
@ -14568,8 +14582,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'undefined.\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'The "co_positions()" method\n'
|
||||
'~~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
|
||||
'Methods on code objects\n'
|
||||
'~~~~~~~~~~~~~~~~~~~~~~~\n'
|
||||
'\n'
|
||||
'codeobject.co_positions()\n'
|
||||
'\n'
|
||||
|
@ -14617,14 +14631,63 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'the\n'
|
||||
' "PYTHONNODEBUGRANGES" environment variable can be used.\n'
|
||||
'\n'
|
||||
'codeobject.co_lines()\n'
|
||||
'\n'
|
||||
' Returns an iterator that yields information about successive '
|
||||
'ranges\n'
|
||||
' of *bytecode*s. Each item yielded is a "(start, end, lineno)"\n'
|
||||
' "tuple":\n'
|
||||
'\n'
|
||||
' * "start" (an "int") represents the offset (inclusive) of the '
|
||||
'start\n'
|
||||
' of the *bytecode* range\n'
|
||||
'\n'
|
||||
' * "end" (an "int") represents the offset (exclusive) of the end '
|
||||
'of\n'
|
||||
' the *bytecode* range\n'
|
||||
'\n'
|
||||
' * "lineno" is an "int" representing the line number of the\n'
|
||||
' *bytecode* range, or "None" if the bytecodes in the given '
|
||||
'range\n'
|
||||
' have no line number\n'
|
||||
'\n'
|
||||
' The items yielded will have the following properties:\n'
|
||||
'\n'
|
||||
' * The first range yielded will have a "start" of 0.\n'
|
||||
'\n'
|
||||
' * The "(start, end)" ranges will be non-decreasing and '
|
||||
'consecutive.\n'
|
||||
' That is, for any pair of "tuple"s, the "start" of the second '
|
||||
'will\n'
|
||||
' be equal to the "end" of the first.\n'
|
||||
'\n'
|
||||
' * No range will be backwards: "end >= start" for all triples.\n'
|
||||
'\n'
|
||||
' * The last "tuple" yielded will have "end" equal to the size of '
|
||||
'the\n'
|
||||
' *bytecode*.\n'
|
||||
'\n'
|
||||
' Zero-width ranges, where "start == end", are allowed. '
|
||||
'Zero-width\n'
|
||||
' ranges are used for lines that are present in the source code, '
|
||||
'but\n'
|
||||
' have been eliminated by the *bytecode* compiler.\n'
|
||||
'\n'
|
||||
' New in version 3.10.\n'
|
||||
'\n'
|
||||
' See also:\n'
|
||||
'\n'
|
||||
' **PEP 626** - Precise line numbers for debugging and other '
|
||||
'tools.\n'
|
||||
' The PEP that introduced the "co_lines()" method.\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Frame objects\n'
|
||||
'-------------\n'
|
||||
'\n'
|
||||
'Frame objects represent execution frames. They may occur in '
|
||||
'traceback\n'
|
||||
'objects (see below), and are also passed to registered trace\n'
|
||||
'functions.\n'
|
||||
'objects, and are also passed to registered trace functions.\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Special read-only attributes\n'
|
||||
|
@ -14737,11 +14800,14 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'Traceback objects\n'
|
||||
'-----------------\n'
|
||||
'\n'
|
||||
'Traceback objects represent a stack trace of an exception. A\n'
|
||||
'Traceback objects represent the stack trace of an exception. A\n'
|
||||
'traceback object is implicitly created when an exception occurs, '
|
||||
'and\n'
|
||||
'may also be explicitly created by calling "types.TracebackType".\n'
|
||||
'\n'
|
||||
'Changed in version 3.7: Traceback objects can now be explicitly\n'
|
||||
'instantiated from Python code.\n'
|
||||
'\n'
|
||||
'For implicitly created tracebacks, when the search for an '
|
||||
'exception\n'
|
||||
'handler unwinds the execution stack, at each unwound level a '
|
||||
|
@ -14764,30 +14830,40 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'linked\n'
|
||||
'to form a full stack trace.\n'
|
||||
'\n'
|
||||
'Special read-only attributes: "tb_frame" points to the execution '
|
||||
'frame\n'
|
||||
'of the current level; "tb_lineno" gives the line number where the\n'
|
||||
'exception occurred; "tb_lasti" indicates the precise instruction. '
|
||||
'The\n'
|
||||
'line number and last instruction in the traceback may differ from '
|
||||
'Special read-only attributes:\n'
|
||||
'\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| traceback.tb_frame | Points to '
|
||||
'the execution frame of the current |\n'
|
||||
'| | level. '
|
||||
'Accessing this attribute raises an |\n'
|
||||
'| | auditing '
|
||||
'event "object.__getattr__" with arguments |\n'
|
||||
'| | "obj" and '
|
||||
'""tb_frame"". |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| traceback.tb_lineno | Gives the '
|
||||
'line number where the exception occurred |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| traceback.tb_lasti | Indicates '
|
||||
'the “precise instruction”. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'\n'
|
||||
'The line number and last instruction in the traceback may differ '
|
||||
'from\n'
|
||||
'the line number of its frame object if the exception occurred in a\n'
|
||||
'"try" statement with no matching except clause or with a "finally"\n'
|
||||
'clause.\n'
|
||||
'\n'
|
||||
'traceback.tb_next\n'
|
||||
'\n'
|
||||
' The special writable attribute "tb_next" is the next level in '
|
||||
'the\n'
|
||||
'line number of its frame object if the exception occurred in a '
|
||||
'"try"\n'
|
||||
'statement with no matching except clause or with a finally clause.\n'
|
||||
' stack trace (towards the frame where the exception occurred), '
|
||||
'or\n'
|
||||
' "None" if there is no next level.\n'
|
||||
'\n'
|
||||
'Accessing "tb_frame" raises an auditing event "object.__getattr__"\n'
|
||||
'with arguments "obj" and ""tb_frame"".\n'
|
||||
'\n'
|
||||
'Special writable attribute: "tb_next" is the next level in the '
|
||||
'stack\n'
|
||||
'trace (towards the frame where the exception occurred), or "None" '
|
||||
'if\n'
|
||||
'there is no next level.\n'
|
||||
'\n'
|
||||
'Changed in version 3.7: Traceback objects can now be explicitly\n'
|
||||
'instantiated from Python code, and the "tb_next" attribute of '
|
||||
'existing\n'
|
||||
'instances can be updated.\n'
|
||||
' Changed in version 3.7: This attribute is now writable\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Slice objects\n'
|
||||
|
@ -14844,8 +14920,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'around another object that alters the way in which that object is\n'
|
||||
'retrieved from classes and class instances. The behaviour of class\n'
|
||||
'method objects upon such retrieval is described above, under '
|
||||
'“User-\n'
|
||||
'defined methods”. Class method objects are created by the built-in\n'
|
||||
'“instance\n'
|
||||
'methods”. Class method objects are created by the built-in\n'
|
||||
'"classmethod()" constructor.\n',
|
||||
'typesfunctions': 'Functions\n'
|
||||
'*********\n'
|
||||
|
@ -15364,7 +15440,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'notation.\n'
|
||||
'There are two flavors: built-in methods (such as "append()" '
|
||||
'on lists)\n'
|
||||
'and class instance methods. Built-in methods are described '
|
||||
'and class instance method. Built-in methods are described '
|
||||
'with the\n'
|
||||
'types that support them.\n'
|
||||
'\n'
|
||||
|
@ -15372,8 +15448,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'namespace)\n'
|
||||
'through an instance, you get a special object: a *bound '
|
||||
'method* (also\n'
|
||||
'called *instance method*) object. When called, it will add '
|
||||
'the "self"\n'
|
||||
'called instance method) object. When called, it will add the '
|
||||
'"self"\n'
|
||||
'argument to the argument list. Bound methods have two '
|
||||
'special read-\n'
|
||||
'only attributes: "m.__self__" is the object on which the '
|
||||
|
@ -15388,7 +15464,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'arbitrary\n'
|
||||
'attributes. However, since method attributes are actually '
|
||||
'stored on\n'
|
||||
'the underlying function object ("meth.__func__"), setting '
|
||||
'the underlying function object ("method.__func__"), setting '
|
||||
'method\n'
|
||||
'attributes on bound methods is disallowed. Attempting to '
|
||||
'set an\n'
|
||||
|
@ -15413,7 +15489,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' >>> c.method.whoami\n'
|
||||
" 'my name is method'\n"
|
||||
'\n'
|
||||
'See The standard type hierarchy for more information.\n',
|
||||
'See Instance methods for more information.\n',
|
||||
'typesmodules': 'Modules\n'
|
||||
'*******\n'
|
||||
'\n'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue