mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
Python 3.14.0a2
This commit is contained in:
parent
4d771977b1
commit
add43c3420
184 changed files with 2085 additions and 618 deletions
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Autogenerated by Sphinx on Tue Oct 15 22:34:02 2024
|
||||
# Autogenerated by Sphinx on Tue Nov 19 16:52:22 2024
|
||||
# as part of the release process.
|
||||
topics = {'assert': 'The "assert" statement\n'
|
||||
'**********************\n'
|
||||
|
@ -29,13 +29,12 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'(command\n'
|
||||
'line option "-O"). The current code generator emits no code for '
|
||||
'an\n'
|
||||
'assert statement when optimization is requested at compile time. '
|
||||
'Note\n'
|
||||
'that it is unnecessary to include the source code for the '
|
||||
'expression\n'
|
||||
'that failed in the error message; it will be displayed as part of '
|
||||
'the\n'
|
||||
'stack trace.\n'
|
||||
'"assert" statement when optimization is requested at compile '
|
||||
'time.\n'
|
||||
'Note that it is unnecessary to include the source code for the\n'
|
||||
'expression that failed in the error message; it will be displayed '
|
||||
'as\n'
|
||||
'part of the stack trace.\n'
|
||||
'\n'
|
||||
'Assignments to "__debug__" are illegal. The value for the '
|
||||
'built-in\n'
|
||||
|
@ -713,7 +712,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'should either\n'
|
||||
' return the (computed) attribute value or raise an '
|
||||
'"AttributeError"\n'
|
||||
' exception.\n'
|
||||
' exception. The "object" class itself does not provide '
|
||||
'this method.\n'
|
||||
'\n'
|
||||
' Note that if the attribute is found through the '
|
||||
'normal mechanism,\n'
|
||||
|
@ -896,7 +896,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'parents). In the\n'
|
||||
'examples below, “the attribute” refers to the attribute '
|
||||
'whose name is\n'
|
||||
'the key of the property in the owner class’ "__dict__".\n'
|
||||
'the key of the property in the owner class’ "__dict__". '
|
||||
'The "object"\n'
|
||||
'class itself does not implement any of these protocols.\n'
|
||||
'\n'
|
||||
'object.__get__(self, instance, owner=None)\n'
|
||||
'\n'
|
||||
|
@ -1569,7 +1571,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' Called when the instance is “called” as a function; if '
|
||||
'this method\n'
|
||||
' is defined, "x(arg1, arg2, ...)" roughly translates to\n'
|
||||
' "type(x).__call__(x, arg1, ...)".\n',
|
||||
' "type(x).__call__(x, arg1, ...)". The "object" class '
|
||||
'itself does\n'
|
||||
' not provide this method.\n',
|
||||
'calls': 'Calls\n'
|
||||
'*****\n'
|
||||
'\n'
|
||||
|
@ -1754,6 +1758,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' Function definitions. When the code block executes a "return"\n'
|
||||
' statement, this specifies the return value of the function '
|
||||
'call.\n'
|
||||
' If execution reaches the end of the code block without executing '
|
||||
'a\n'
|
||||
' "return" statement, the return value is "None".\n'
|
||||
'\n'
|
||||
'a built-in function or method:\n'
|
||||
' The result is up to the interpreter; see Built-in Functions for '
|
||||
|
@ -2802,18 +2809,15 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' enter = type(manager).__enter__\n'
|
||||
' exit = type(manager).__exit__\n'
|
||||
' value = enter(manager)\n'
|
||||
' hit_except = False\n'
|
||||
'\n'
|
||||
' try:\n'
|
||||
' TARGET = value\n'
|
||||
' SUITE\n'
|
||||
' except:\n'
|
||||
' hit_except = True\n'
|
||||
' if not exit(manager, *sys.exc_info()):\n'
|
||||
' raise\n'
|
||||
' finally:\n'
|
||||
' if not hit_except:\n'
|
||||
' exit(manager, None, None, None)\n'
|
||||
' else:\n'
|
||||
' exit(manager, None, None, None)\n'
|
||||
'\n'
|
||||
'With more than one item, the context managers are processed as '
|
||||
'if\n'
|
||||
|
@ -4495,6 +4499,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'For more information on context managers, see Context '
|
||||
'Manager Types.\n'
|
||||
'The "object" class itself does not provide the context '
|
||||
'manager\n'
|
||||
'methods.\n'
|
||||
'\n'
|
||||
'object.__enter__(self)\n'
|
||||
'\n'
|
||||
|
@ -4764,17 +4771,20 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' This is typically used for debugging, so it is important '
|
||||
'that the\n'
|
||||
' representation is information-rich and unambiguous.\n'
|
||||
' representation is information-rich and unambiguous. A '
|
||||
'default\n'
|
||||
' implementation is provided by the "object" class '
|
||||
'itself.\n'
|
||||
'\n'
|
||||
'object.__str__(self)\n'
|
||||
'\n'
|
||||
' Called by "str(object)" and the built-in functions '
|
||||
'"format()" and\n'
|
||||
' "print()" to compute the “informal” or nicely printable '
|
||||
'string\n'
|
||||
' representation of an object. The return value must be a '
|
||||
'string\n'
|
||||
' object.\n'
|
||||
' Called by "str(object)", the default "__format__()" '
|
||||
'implementation,\n'
|
||||
' and the built-in function "print()", to compute the '
|
||||
'“informal” or\n'
|
||||
' nicely printable string representation of an object. '
|
||||
'The return\n'
|
||||
' value must be a str object.\n'
|
||||
'\n'
|
||||
' This method differs from "object.__repr__()" in that '
|
||||
'there is no\n'
|
||||
|
@ -4790,7 +4800,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' Called by bytes to compute a byte-string representation '
|
||||
'of an\n'
|
||||
' object. This should return a "bytes" object.\n'
|
||||
' object. This should return a "bytes" object. The '
|
||||
'"object" class\n'
|
||||
' itself does not provide this method.\n'
|
||||
'\n'
|
||||
'object.__format__(self, format_spec)\n'
|
||||
'\n'
|
||||
|
@ -4818,6 +4830,11 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' The return value must be a string object.\n'
|
||||
'\n'
|
||||
' The default implementation by the "object" class should '
|
||||
'be given an\n'
|
||||
' empty *format_spec* string. It delegates to '
|
||||
'"__str__()".\n'
|
||||
'\n'
|
||||
' Changed in version 3.4: The __format__ method of '
|
||||
'"object" itself\n'
|
||||
' raises a "TypeError" if passed any non-empty string.\n'
|
||||
|
@ -4875,6 +4892,16 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' ordering operations from a single root operation, see\n'
|
||||
' "functools.total_ordering()".\n'
|
||||
'\n'
|
||||
' By default, the "object" class provides implementations '
|
||||
'consistent\n'
|
||||
' with Value comparisons: equality compares according to '
|
||||
'object\n'
|
||||
' identity, and order comparisons raise "TypeError". Each '
|
||||
'default\n'
|
||||
' method may generate these results directly, but may also '
|
||||
'return\n'
|
||||
' "NotImplemented".\n'
|
||||
'\n'
|
||||
' See the paragraph on "__hash__()" for some important '
|
||||
'notes on\n'
|
||||
' creating *hashable* objects which support custom '
|
||||
|
@ -4961,12 +4988,13 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' User-defined classes have "__eq__()" and "__hash__()" '
|
||||
'methods by\n'
|
||||
' default; with them, all objects compare unequal (except '
|
||||
'with\n'
|
||||
' themselves) and "x.__hash__()" returns an appropriate '
|
||||
'value such\n'
|
||||
' that "x == y" implies both that "x is y" and "hash(x) == '
|
||||
'hash(y)".\n'
|
||||
' default (inherited from the "object" class); with them, '
|
||||
'all objects\n'
|
||||
' compare unequal (except with themselves) and '
|
||||
'"x.__hash__()" returns\n'
|
||||
' an appropriate value such that "x == y" implies both '
|
||||
'that "x is y"\n'
|
||||
' and "hash(x) == hash(y)".\n'
|
||||
'\n'
|
||||
' A class that overrides "__eq__()" and does not define '
|
||||
'"__hash__()"\n'
|
||||
|
@ -5037,9 +5065,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'the object is\n'
|
||||
' considered true if its result is nonzero. If a class '
|
||||
'defines\n'
|
||||
' neither "__len__()" nor "__bool__()", all its instances '
|
||||
'are\n'
|
||||
' considered true.\n',
|
||||
' neither "__len__()" nor "__bool__()" (which is true of '
|
||||
'the "object"\n'
|
||||
' class itself), all its instances are considered true.\n',
|
||||
'debugger': '"pdb" — The Python Debugger\n'
|
||||
'***************************\n'
|
||||
'\n'
|
||||
|
@ -7038,10 +7066,12 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'printing fields |\n'
|
||||
'| | in the form ‘+000000120’. This alignment '
|
||||
'option is only |\n'
|
||||
'| | valid for numeric types. It becomes the '
|
||||
'default for |\n'
|
||||
'| | numbers when ‘0’ immediately precedes the '
|
||||
'field width. |\n'
|
||||
'| | valid for numeric types, excluding "complex". '
|
||||
'It becomes |\n'
|
||||
'| | the default for numbers when ‘0’ immediately '
|
||||
'precedes the |\n'
|
||||
'| | field '
|
||||
'width. |\n'
|
||||
'+-----------+------------------------------------------------------------+\n'
|
||||
'| "\'^\'" | Forces the field to be centered within the '
|
||||
'available |\n'
|
||||
|
@ -7148,9 +7178,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'field by a\n'
|
||||
'zero ("\'0\'") character enables sign-aware zero-padding '
|
||||
'for numeric\n'
|
||||
'types. This is equivalent to a *fill* character of "\'0\'" '
|
||||
'with an\n'
|
||||
'*alignment* type of "\'=\'".\n'
|
||||
'types, excluding "complex". This is equivalent to a *fill* '
|
||||
'character\n'
|
||||
'of "\'0\'" with an *alignment* type of "\'=\'".\n'
|
||||
'\n'
|
||||
'Changed in version 3.10: Preceding the *width* field by '
|
||||
'"\'0\'" no\n'
|
||||
|
@ -7416,6 +7446,32 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' '
|
||||
'+-----------+------------------------------------------------------------+\n'
|
||||
'\n'
|
||||
'The result should be correctly rounded to a given precision '
|
||||
'"p" of\n'
|
||||
'digits after the decimal point. The rounding mode for '
|
||||
'"float" matches\n'
|
||||
'that of the "round()" builtin. For "Decimal", the rounding '
|
||||
'mode of\n'
|
||||
'the current context will be used.\n'
|
||||
'\n'
|
||||
'The available presentation types for "complex" are the same '
|
||||
'as those\n'
|
||||
'for "float" ("\'%\'" is not allowed). Both the real and '
|
||||
'imaginary\n'
|
||||
'components of a complex number are formatted as '
|
||||
'floating-point\n'
|
||||
'numbers, according to the specified presentation type. '
|
||||
'They are\n'
|
||||
'separated by the mandatory sign of the imaginary part, the '
|
||||
'latter\n'
|
||||
'being terminated by a "j" suffix. If the presentation type '
|
||||
'is\n'
|
||||
'missing, the result will match the output of "str()" '
|
||||
'(complex numbers\n'
|
||||
'with a non-zero real part are also surrounded by '
|
||||
'parentheses),\n'
|
||||
'possibly altered by other format modifiers.\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Format examples\n'
|
||||
'===============\n'
|
||||
|
@ -7800,33 +7856,17 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' global_stmt ::= "global" identifier ("," identifier)*\n'
|
||||
'\n'
|
||||
'The "global" statement is a declaration which holds for the '
|
||||
'entire\n'
|
||||
'current code block. It means that the listed identifiers are to '
|
||||
'be\n'
|
||||
'interpreted as globals. It would be impossible to assign to a '
|
||||
'global\n'
|
||||
'variable without "global", although free variables may refer to\n'
|
||||
'globals without being declared global.\n'
|
||||
'The "global" statement causes the listed identifiers to be '
|
||||
'interpreted\n'
|
||||
'as globals. It would be impossible to assign to a global variable\n'
|
||||
'without "global", although free variables may refer to globals '
|
||||
'without\n'
|
||||
'being declared global.\n'
|
||||
'\n'
|
||||
'Names listed in a "global" statement must not be used in the same '
|
||||
'code\n'
|
||||
'block textually preceding that "global" statement.\n'
|
||||
'\n'
|
||||
'Names listed in a "global" statement must not be defined as '
|
||||
'formal\n'
|
||||
'parameters, or as targets in "with" statements or "except" '
|
||||
'clauses, or\n'
|
||||
'in a "for" target list, "class" definition, function definition,\n'
|
||||
'"import" statement, or *variable annotations*.\n'
|
||||
'\n'
|
||||
'**CPython implementation detail:** The current implementation does '
|
||||
'not\n'
|
||||
'enforce some of these restrictions, but programs should not abuse '
|
||||
'this\n'
|
||||
'freedom, as future implementations may enforce them or silently '
|
||||
'change\n'
|
||||
'the meaning of the program.\n'
|
||||
'The "global" statement applies to the entire scope of a function '
|
||||
'or\n'
|
||||
'class body. A "SyntaxError" is raised if a variable is used or\n'
|
||||
'assigned to prior to its global declaration in the scope.\n'
|
||||
'\n'
|
||||
'**Programmer’s note:** "global" is a directive to the parser. It\n'
|
||||
'applies only to code parsed at the same time as the "global"\n'
|
||||
|
@ -8896,8 +8936,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'scope,\n'
|
||||
'or if there is no nonlocal scope, a "SyntaxError" is raised.\n'
|
||||
'\n'
|
||||
'The nonlocal statement applies to the entire scope of a function '
|
||||
'or\n'
|
||||
'The "nonlocal" statement applies to the entire scope of a '
|
||||
'function or\n'
|
||||
'class body. A "SyntaxError" is raised if a variable is used or\n'
|
||||
'assigned to prior to its nonlocal declaration in the scope.\n'
|
||||
'\n'
|
||||
|
@ -8996,17 +9036,21 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'"divmod()",\n'
|
||||
' "pow()", "**", "<<", ">>", "&", "^", "|") with reflected '
|
||||
'(swapped)\n'
|
||||
' operands. These functions are only called if the left '
|
||||
'operand does\n'
|
||||
' not support the corresponding operation [3] and the '
|
||||
' operands. These functions are only called if the '
|
||||
'operands are of\n'
|
||||
' different types. [4] For instance, to evaluate the '
|
||||
'expression "x -\n'
|
||||
' y", where *y* is an instance of a class that has an '
|
||||
'"__rsub__()"\n'
|
||||
' method, "type(y).__rsub__(y, x)" is called if '
|
||||
'"type(x).__sub__(x,\n'
|
||||
' y)" returns "NotImplemented".\n'
|
||||
' different types, when the left operand does not support '
|
||||
'the\n'
|
||||
' corresponding operation [3], or the right operand’s '
|
||||
'class is\n'
|
||||
' derived from the left operand’s class. [4] For instance, '
|
||||
'to\n'
|
||||
' evaluate the expression "x - y", where *y* is an '
|
||||
'instance of a\n'
|
||||
' class that has an "__rsub__()" method, '
|
||||
'"type(y).__rsub__(y, x)" is\n'
|
||||
' called if "type(x).__sub__(x, y)" returns '
|
||||
'"NotImplemented" or\n'
|
||||
' "type(y)" is a subclass of "type(x)". [5]\n'
|
||||
'\n'
|
||||
' Note that ternary "pow()" will not try calling '
|
||||
'"__rpow__()" (the\n'
|
||||
|
@ -9651,56 +9695,58 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'The following methods can be defined to implement '
|
||||
'container objects.\n'
|
||||
'Containers usually are *sequences* (such as "lists" or '
|
||||
'"tuples") or\n'
|
||||
'*mappings* (like "dictionaries"), but can represent other '
|
||||
'containers\n'
|
||||
'as well. The first set of methods is used either to '
|
||||
'emulate a\n'
|
||||
'sequence or to emulate a mapping; the difference is that '
|
||||
'for a\n'
|
||||
'sequence, the allowable keys should be the integers *k* '
|
||||
'for which "0\n'
|
||||
'<= k < N" where *N* is the length of the sequence, or '
|
||||
'"slice" objects,\n'
|
||||
'which define a range of items. It is also recommended '
|
||||
'that mappings\n'
|
||||
'provide the methods "keys()", "values()", "items()", '
|
||||
'"get()",\n'
|
||||
'"clear()", "setdefault()", "pop()", "popitem()", "copy()", '
|
||||
'None of them are provided by the "object" class itself. '
|
||||
'Containers\n'
|
||||
'usually are *sequences* (such as "lists" or "tuples") or '
|
||||
'*mappings*\n'
|
||||
'(like *dictionaries*), but can represent other containers '
|
||||
'as well.\n'
|
||||
'The first set of methods is used either to emulate a '
|
||||
'sequence or to\n'
|
||||
'emulate a mapping; the difference is that for a sequence, '
|
||||
'the\n'
|
||||
'allowable keys should be the integers *k* for which "0 <= '
|
||||
'k < N" where\n'
|
||||
'*N* is the length of the sequence, or "slice" objects, '
|
||||
'which define a\n'
|
||||
'range of items. It is also recommended that mappings '
|
||||
'provide the\n'
|
||||
'methods "keys()", "values()", "items()", "get()", '
|
||||
'"clear()",\n'
|
||||
'"setdefault()", "pop()", "popitem()", "copy()", and '
|
||||
'"update()"\n'
|
||||
'behaving similar to those for Python’s standard '
|
||||
'"dictionary" objects.\n'
|
||||
'The "collections.abc" module provides a "MutableMapping" '
|
||||
'*abstract\n'
|
||||
'base class* to help create those methods from a base set '
|
||||
'of\n'
|
||||
'"__getitem__()", "__setitem__()", "__delitem__()", and '
|
||||
'"keys()".\n'
|
||||
'Mutable sequences should provide methods "append()", '
|
||||
'"count()",\n'
|
||||
'"index()", "extend()", "insert()", "pop()", "remove()", '
|
||||
'"reverse()"\n'
|
||||
'and "sort()", like Python standard "list" objects. '
|
||||
'Finally, sequence\n'
|
||||
'types should implement addition (meaning concatenation) '
|
||||
'and\n'
|
||||
'"update()" behaving similar to those for Python’s '
|
||||
'standard\n'
|
||||
'"dictionary" objects. The "collections.abc" module '
|
||||
'provides a\n'
|
||||
'"MutableMapping" *abstract base class* to help create '
|
||||
'those methods\n'
|
||||
'from a base set of "__getitem__()", "__setitem__()", '
|
||||
'"__delitem__()",\n'
|
||||
'and "keys()". Mutable sequences should provide methods '
|
||||
'"append()",\n'
|
||||
'"count()", "index()", "extend()", "insert()", "pop()", '
|
||||
'"remove()",\n'
|
||||
'"reverse()" and "sort()", like Python standard "list" '
|
||||
'objects.\n'
|
||||
'Finally, sequence types should implement addition '
|
||||
'(meaning\n'
|
||||
'concatenation) and multiplication (meaning repetition) by '
|
||||
'defining the\n'
|
||||
'methods "__add__()", "__radd__()", "__iadd__()", '
|
||||
'"__mul__()",\n'
|
||||
'"__rmul__()" and "__imul__()" described below; they should '
|
||||
'not define\n'
|
||||
'other numerical operators. It is recommended that both '
|
||||
'mappings and\n'
|
||||
'sequences implement the "__contains__()" method to allow '
|
||||
'efficient use\n'
|
||||
'of the "in" operator; for mappings, "in" should search the '
|
||||
'mapping’s\n'
|
||||
'keys; for sequences, it should search through the values. '
|
||||
'It is\n'
|
||||
'further recommended that both mappings and sequences '
|
||||
'implement the\n'
|
||||
'multiplication (meaning repetition) by defining the '
|
||||
'methods\n'
|
||||
'"__add__()", "__radd__()", "__iadd__()", "__mul__()", '
|
||||
'"__rmul__()" and\n'
|
||||
'"__imul__()" described below; they should not define other '
|
||||
'numerical\n'
|
||||
'operators. It is recommended that both mappings and '
|
||||
'sequences\n'
|
||||
'implement the "__contains__()" method to allow efficient '
|
||||
'use of the\n'
|
||||
'"in" operator; for mappings, "in" should search the '
|
||||
'mapping’s keys;\n'
|
||||
'for sequences, it should search through the values. It is '
|
||||
'further\n'
|
||||
'recommended that both mappings and sequences implement '
|
||||
'the\n'
|
||||
'"__iter__()" method to allow efficient iteration through '
|
||||
'the\n'
|
||||
'container; for mappings, "__iter__()" should iterate '
|
||||
|
@ -10240,17 +10286,19 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' This is typically used for debugging, so it is important '
|
||||
'that the\n'
|
||||
' representation is information-rich and unambiguous.\n'
|
||||
' representation is information-rich and unambiguous. A '
|
||||
'default\n'
|
||||
' implementation is provided by the "object" class itself.\n'
|
||||
'\n'
|
||||
'object.__str__(self)\n'
|
||||
'\n'
|
||||
' Called by "str(object)" and the built-in functions '
|
||||
'"format()" and\n'
|
||||
' "print()" to compute the “informal” or nicely printable '
|
||||
'string\n'
|
||||
' representation of an object. The return value must be a '
|
||||
'string\n'
|
||||
' object.\n'
|
||||
' Called by "str(object)", the default "__format__()" '
|
||||
'implementation,\n'
|
||||
' and the built-in function "print()", to compute the '
|
||||
'“informal” or\n'
|
||||
' nicely printable string representation of an object. The '
|
||||
'return\n'
|
||||
' value must be a str object.\n'
|
||||
'\n'
|
||||
' This method differs from "object.__repr__()" in that '
|
||||
'there is no\n'
|
||||
|
@ -10266,7 +10314,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' Called by bytes to compute a byte-string representation '
|
||||
'of an\n'
|
||||
' object. This should return a "bytes" object.\n'
|
||||
' object. This should return a "bytes" object. The "object" '
|
||||
'class\n'
|
||||
' itself does not provide this method.\n'
|
||||
'\n'
|
||||
'object.__format__(self, format_spec)\n'
|
||||
'\n'
|
||||
|
@ -10294,6 +10344,10 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' The return value must be a string object.\n'
|
||||
'\n'
|
||||
' The default implementation by the "object" class should '
|
||||
'be given an\n'
|
||||
' empty *format_spec* string. It delegates to "__str__()".\n'
|
||||
'\n'
|
||||
' Changed in version 3.4: The __format__ method of "object" '
|
||||
'itself\n'
|
||||
' raises a "TypeError" if passed any non-empty string.\n'
|
||||
|
@ -10351,6 +10405,16 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' ordering operations from a single root operation, see\n'
|
||||
' "functools.total_ordering()".\n'
|
||||
'\n'
|
||||
' By default, the "object" class provides implementations '
|
||||
'consistent\n'
|
||||
' with Value comparisons: equality compares according to '
|
||||
'object\n'
|
||||
' identity, and order comparisons raise "TypeError". Each '
|
||||
'default\n'
|
||||
' method may generate these results directly, but may also '
|
||||
'return\n'
|
||||
' "NotImplemented".\n'
|
||||
'\n'
|
||||
' See the paragraph on "__hash__()" for some important '
|
||||
'notes on\n'
|
||||
' creating *hashable* objects which support custom '
|
||||
|
@ -10436,12 +10500,13 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' User-defined classes have "__eq__()" and "__hash__()" '
|
||||
'methods by\n'
|
||||
' default; with them, all objects compare unequal (except '
|
||||
'with\n'
|
||||
' themselves) and "x.__hash__()" returns an appropriate '
|
||||
'value such\n'
|
||||
' that "x == y" implies both that "x is y" and "hash(x) == '
|
||||
'hash(y)".\n'
|
||||
' default (inherited from the "object" class); with them, '
|
||||
'all objects\n'
|
||||
' compare unequal (except with themselves) and '
|
||||
'"x.__hash__()" returns\n'
|
||||
' an appropriate value such that "x == y" implies both that '
|
||||
'"x is y"\n'
|
||||
' and "hash(x) == hash(y)".\n'
|
||||
'\n'
|
||||
' A class that overrides "__eq__()" and does not define '
|
||||
'"__hash__()"\n'
|
||||
|
@ -10510,9 +10575,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'object is\n'
|
||||
' considered true if its result is nonzero. If a class '
|
||||
'defines\n'
|
||||
' neither "__len__()" nor "__bool__()", all its instances '
|
||||
'are\n'
|
||||
' considered true.\n'
|
||||
' neither "__len__()" nor "__bool__()" (which is true of '
|
||||
'the "object"\n'
|
||||
' class itself), all its instances are considered true.\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Customizing attribute access\n'
|
||||
|
@ -10536,7 +10601,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'either\n'
|
||||
' return the (computed) attribute value or raise an '
|
||||
'"AttributeError"\n'
|
||||
' exception.\n'
|
||||
' exception. The "object" class itself does not provide '
|
||||
'this method.\n'
|
||||
'\n'
|
||||
' Note that if the attribute is found through the normal '
|
||||
'mechanism,\n'
|
||||
|
@ -10716,7 +10782,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'parents). In the\n'
|
||||
'examples below, “the attribute” refers to the attribute '
|
||||
'whose name is\n'
|
||||
'the key of the property in the owner class’ "__dict__".\n'
|
||||
'the key of the property in the owner class’ "__dict__". The '
|
||||
'"object"\n'
|
||||
'class itself does not implement any of these protocols.\n'
|
||||
'\n'
|
||||
'object.__get__(self, instance, owner=None)\n'
|
||||
'\n'
|
||||
|
@ -11599,7 +11667,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' Called when the instance is “called” as a function; if '
|
||||
'this method\n'
|
||||
' is defined, "x(arg1, arg2, ...)" roughly translates to\n'
|
||||
' "type(x).__call__(x, arg1, ...)".\n'
|
||||
' "type(x).__call__(x, arg1, ...)". The "object" class '
|
||||
'itself does\n'
|
||||
' not provide this method.\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Emulating container types\n'
|
||||
|
@ -11607,54 +11677,54 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'The following methods can be defined to implement container '
|
||||
'objects.\n'
|
||||
'Containers usually are *sequences* (such as "lists" or '
|
||||
'"tuples") or\n'
|
||||
'*mappings* (like "dictionaries"), but can represent other '
|
||||
'containers\n'
|
||||
'as well. The first set of methods is used either to emulate '
|
||||
'a\n'
|
||||
'sequence or to emulate a mapping; the difference is that for '
|
||||
'a\n'
|
||||
'sequence, the allowable keys should be the integers *k* for '
|
||||
'which "0\n'
|
||||
'<= k < N" where *N* is the length of the sequence, or '
|
||||
'"slice" objects,\n'
|
||||
'which define a range of items. It is also recommended that '
|
||||
'mappings\n'
|
||||
'provide the methods "keys()", "values()", "items()", '
|
||||
'"get()",\n'
|
||||
'"clear()", "setdefault()", "pop()", "popitem()", "copy()", '
|
||||
'and\n'
|
||||
'"update()" behaving similar to those for Python’s standard\n'
|
||||
'"dictionary" objects. The "collections.abc" module provides '
|
||||
'a\n'
|
||||
'"MutableMapping" *abstract base class* to help create those '
|
||||
'methods\n'
|
||||
'from a base set of "__getitem__()", "__setitem__()", '
|
||||
'"__delitem__()",\n'
|
||||
'and "keys()". Mutable sequences should provide methods '
|
||||
'"append()",\n'
|
||||
'"count()", "index()", "extend()", "insert()", "pop()", '
|
||||
'"remove()",\n'
|
||||
'"reverse()" and "sort()", like Python standard "list" '
|
||||
'None of them are provided by the "object" class itself. '
|
||||
'Containers\n'
|
||||
'usually are *sequences* (such as "lists" or "tuples") or '
|
||||
'*mappings*\n'
|
||||
'(like *dictionaries*), but can represent other containers as '
|
||||
'well.\n'
|
||||
'The first set of methods is used either to emulate a '
|
||||
'sequence or to\n'
|
||||
'emulate a mapping; the difference is that for a sequence, '
|
||||
'the\n'
|
||||
'allowable keys should be the integers *k* for which "0 <= k '
|
||||
'< N" where\n'
|
||||
'*N* is the length of the sequence, or "slice" objects, which '
|
||||
'define a\n'
|
||||
'range of items. It is also recommended that mappings '
|
||||
'provide the\n'
|
||||
'methods "keys()", "values()", "items()", "get()", '
|
||||
'"clear()",\n'
|
||||
'"setdefault()", "pop()", "popitem()", "copy()", and '
|
||||
'"update()"\n'
|
||||
'behaving similar to those for Python’s standard "dictionary" '
|
||||
'objects.\n'
|
||||
'Finally, sequence types should implement addition (meaning\n'
|
||||
'concatenation) and multiplication (meaning repetition) by '
|
||||
'defining the\n'
|
||||
'methods "__add__()", "__radd__()", "__iadd__()", '
|
||||
'"__mul__()",\n'
|
||||
'"__rmul__()" and "__imul__()" described below; they should '
|
||||
'not define\n'
|
||||
'other numerical operators. It is recommended that both '
|
||||
'mappings and\n'
|
||||
'sequences implement the "__contains__()" method to allow '
|
||||
'efficient use\n'
|
||||
'of the "in" operator; for mappings, "in" should search the '
|
||||
'mapping’s\n'
|
||||
'keys; for sequences, it should search through the values. '
|
||||
'It is\n'
|
||||
'further recommended that both mappings and sequences '
|
||||
'implement the\n'
|
||||
'The "collections.abc" module provides a "MutableMapping" '
|
||||
'*abstract\n'
|
||||
'base class* to help create those methods from a base set of\n'
|
||||
'"__getitem__()", "__setitem__()", "__delitem__()", and '
|
||||
'"keys()".\n'
|
||||
'Mutable sequences should provide methods "append()", '
|
||||
'"count()",\n'
|
||||
'"index()", "extend()", "insert()", "pop()", "remove()", '
|
||||
'"reverse()"\n'
|
||||
'and "sort()", like Python standard "list" objects. Finally, '
|
||||
'sequence\n'
|
||||
'types should implement addition (meaning concatenation) and\n'
|
||||
'multiplication (meaning repetition) by defining the methods\n'
|
||||
'"__add__()", "__radd__()", "__iadd__()", "__mul__()", '
|
||||
'"__rmul__()" and\n'
|
||||
'"__imul__()" described below; they should not define other '
|
||||
'numerical\n'
|
||||
'operators. It is recommended that both mappings and '
|
||||
'sequences\n'
|
||||
'implement the "__contains__()" method to allow efficient use '
|
||||
'of the\n'
|
||||
'"in" operator; for mappings, "in" should search the '
|
||||
'mapping’s keys;\n'
|
||||
'for sequences, it should search through the values. It is '
|
||||
'further\n'
|
||||
'recommended that both mappings and sequences implement the\n'
|
||||
'"__iter__()" method to allow efficient iteration through '
|
||||
'the\n'
|
||||
'container; for mappings, "__iter__()" should iterate through '
|
||||
|
@ -11913,17 +11983,21 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'"divmod()",\n'
|
||||
' "pow()", "**", "<<", ">>", "&", "^", "|") with reflected '
|
||||
'(swapped)\n'
|
||||
' operands. These functions are only called if the left '
|
||||
'operand does\n'
|
||||
' not support the corresponding operation [3] and the '
|
||||
' operands. These functions are only called if the '
|
||||
'operands are of\n'
|
||||
' different types. [4] For instance, to evaluate the '
|
||||
'expression "x -\n'
|
||||
' y", where *y* is an instance of a class that has an '
|
||||
'"__rsub__()"\n'
|
||||
' method, "type(y).__rsub__(y, x)" is called if '
|
||||
'"type(x).__sub__(x,\n'
|
||||
' y)" returns "NotImplemented".\n'
|
||||
' different types, when the left operand does not support '
|
||||
'the\n'
|
||||
' corresponding operation [3], or the right operand’s class '
|
||||
'is\n'
|
||||
' derived from the left operand’s class. [4] For instance, '
|
||||
'to\n'
|
||||
' evaluate the expression "x - y", where *y* is an instance '
|
||||
'of a\n'
|
||||
' class that has an "__rsub__()" method, '
|
||||
'"type(y).__rsub__(y, x)" is\n'
|
||||
' called if "type(x).__sub__(x, y)" returns '
|
||||
'"NotImplemented" or\n'
|
||||
' "type(y)" is a subclass of "type(x)". [5]\n'
|
||||
'\n'
|
||||
' Note that ternary "pow()" will not try calling '
|
||||
'"__rpow__()" (the\n'
|
||||
|
@ -12066,6 +12140,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'For more information on context managers, see Context '
|
||||
'Manager Types.\n'
|
||||
'The "object" class itself does not provide the context '
|
||||
'manager\n'
|
||||
'methods.\n'
|
||||
'\n'
|
||||
'object.__enter__(self)\n'
|
||||
'\n'
|
||||
|
@ -14794,13 +14871,13 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' modules created dynamically using the "types.ModuleType"\n'
|
||||
' constructor. Previously the attribute was optional.\n'
|
||||
'\n'
|
||||
' Deprecated since version 3.12, removed in version 3.14: Setting\n'
|
||||
' "__loader__" on a module while failing to set "__spec__.loader" '
|
||||
'is\n'
|
||||
' deprecated. In Python 3.14, "__loader__" will cease to be set '
|
||||
' Deprecated since version 3.12, will be removed in version 3.16:\n'
|
||||
' Setting "__loader__" on a module while failing to set\n'
|
||||
' "__spec__.loader" is deprecated. In Python 3.16, "__loader__" '
|
||||
'will\n'
|
||||
' cease to be set or taken into consideration by the import system '
|
||||
'or\n'
|
||||
' taken into consideration by the import system or the standard\n'
|
||||
' library.\n'
|
||||
' the standard library.\n'
|
||||
'\n'
|
||||
'module.__path__\n'
|
||||
'\n'
|
||||
|
@ -15311,7 +15388,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'| | version '
|
||||
'3.12: This attribute of code objects is |\n'
|
||||
'| | deprecated, '
|
||||
'and may be removed in Python 3.14. |\n'
|
||||
'and may be removed in Python 3.15. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| codeobject.co_stacksize | The required '
|
||||
'stack size of the code object |\n'
|
||||
|
@ -15345,10 +15422,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'Other bits in "co_flags" are reserved for internal use.\n'
|
||||
'\n'
|
||||
'If a code object represents a function, the first item in '
|
||||
'"co_consts"\n'
|
||||
'is the documentation string of the function, or "None" if '
|
||||
'undefined.\n'
|
||||
'If a code object represents a function and has a docstring, the '
|
||||
'first\n'
|
||||
'item in "co_consts" is the docstring of the function.\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'Methods on code objects\n'
|
||||
|
@ -15996,10 +16072,10 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'"keys()" method\n'
|
||||
' (in which case "__getitem__()" is called with every '
|
||||
'key returned\n'
|
||||
' from the method). or an iterable of key/value pairs '
|
||||
'(as tuples\n'
|
||||
' or other iterables of length two). If keyword '
|
||||
'arguments are\n'
|
||||
' from the method) or an iterable of key/value pairs (as '
|
||||
'tuples or\n'
|
||||
' other iterables of length two). If keyword arguments '
|
||||
'are\n'
|
||||
' specified, the dictionary is then updated with those '
|
||||
'key/value\n'
|
||||
' pairs: "d.update(red=1, blue=2)".\n'
|
||||
|
@ -17310,18 +17386,15 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' enter = type(manager).__enter__\n'
|
||||
' exit = type(manager).__exit__\n'
|
||||
' value = enter(manager)\n'
|
||||
' hit_except = False\n'
|
||||
'\n'
|
||||
' try:\n'
|
||||
' TARGET = value\n'
|
||||
' SUITE\n'
|
||||
' except:\n'
|
||||
' hit_except = True\n'
|
||||
' if not exit(manager, *sys.exc_info()):\n'
|
||||
' raise\n'
|
||||
' finally:\n'
|
||||
' if not hit_except:\n'
|
||||
' exit(manager, None, None, None)\n'
|
||||
' else:\n'
|
||||
' exit(manager, None, None, None)\n'
|
||||
'\n'
|
||||
'With more than one item, the context managers are processed as if\n'
|
||||
'multiple "with" statements were nested:\n'
|
||||
|
@ -17362,7 +17435,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'A "yield" statement is semantically equivalent to a yield '
|
||||
'expression.\n'
|
||||
'The yield statement can be used to omit the parentheses that would\n'
|
||||
'The "yield" statement can be used to omit the parentheses that '
|
||||
'would\n'
|
||||
'otherwise be required in the equivalent yield expression '
|
||||
'statement.\n'
|
||||
'For example, the yield statements\n'
|
||||
|
@ -17378,10 +17452,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'Yield expressions and statements are only used when defining a\n'
|
||||
'*generator* function, and are only used in the body of the '
|
||||
'generator\n'
|
||||
'function. Using yield in a function definition is sufficient to '
|
||||
'cause\n'
|
||||
'that definition to create a generator function instead of a normal\n'
|
||||
'function.\n'
|
||||
'function. Using "yield" in a function definition is sufficient to\n'
|
||||
'cause that definition to create a generator function instead of a\n'
|
||||
'normal function.\n'
|
||||
'\n'
|
||||
'For full details of "yield" semantics, refer to the Yield '
|
||||
'expressions\n'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue