mirror of
https://github.com/python/cpython.git
synced 2025-08-07 02:18:59 +00:00
Python 3.12.7
This commit is contained in:
parent
3b5bc8d228
commit
0b05ead877
40 changed files with 627 additions and 248 deletions
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Autogenerated by Sphinx on Fri Sep 6 21:00:45 2024
|
||||
# Autogenerated by Sphinx on Tue Oct 1 04:02:04 2024
|
||||
# as part of the release process.
|
||||
topics = {'assert': 'The "assert" statement\n'
|
||||
'**********************\n'
|
||||
|
@ -1094,11 +1094,13 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'to the class\n'
|
||||
' where it is defined. *__slots__* declared in parents '
|
||||
'are available\n'
|
||||
' in child classes. However, child subclasses will get a '
|
||||
'"__dict__"\n'
|
||||
' and *__weakref__* unless they also define *__slots__* '
|
||||
'(which should\n'
|
||||
' only contain names of any *additional* slots).\n'
|
||||
' in child classes. However, instances of a child '
|
||||
'subclass will get a\n'
|
||||
' "__dict__" and *__weakref__* unless the subclass also '
|
||||
'defines\n'
|
||||
' *__slots__* (which should only contain names of any '
|
||||
'*additional*\n'
|
||||
' slots).\n'
|
||||
'\n'
|
||||
'* If a class defines a slot also defined in a base '
|
||||
'class, the instance\n'
|
||||
|
@ -3571,10 +3573,12 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' parameter_list_no_posonly ::= defparameter ("," '
|
||||
'defparameter)* ["," [parameter_list_starargs]]\n'
|
||||
' | parameter_list_starargs\n'
|
||||
' parameter_list_starargs ::= "*" [parameter] ("," '
|
||||
' parameter_list_starargs ::= "*" [star_parameter] ("," '
|
||||
'defparameter)* ["," ["**" parameter [","]]]\n'
|
||||
' | "**" parameter [","]\n'
|
||||
' parameter ::= identifier [":" expression]\n'
|
||||
' star_parameter ::= identifier [":" ["*"] '
|
||||
'expression]\n'
|
||||
' defparameter ::= parameter ["=" expression]\n'
|
||||
' funcname ::= identifier\n'
|
||||
'\n'
|
||||
|
@ -3702,27 +3706,31 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'expression"”\n'
|
||||
'following the parameter name. Any parameter may have an '
|
||||
'annotation,\n'
|
||||
'even those of the form "*identifier" or "**identifier". '
|
||||
'Functions may\n'
|
||||
'have “return” annotation of the form “"-> expression"” after '
|
||||
'the\n'
|
||||
'parameter list. These annotations can be any valid Python '
|
||||
'expression.\n'
|
||||
'The presence of annotations does not change the semantics of a\n'
|
||||
'function. The annotation values are available as values of a\n'
|
||||
'dictionary keyed by the parameters’ names in the '
|
||||
'"__annotations__"\n'
|
||||
'attribute of the function object. If the "annotations" import '
|
||||
'from\n'
|
||||
'"__future__" is used, annotations are preserved as strings at '
|
||||
'runtime\n'
|
||||
'which enables postponed evaluation. Otherwise, they are '
|
||||
'evaluated\n'
|
||||
'when the function definition is executed. In this case '
|
||||
'annotations\n'
|
||||
'may be evaluated in a different order than they appear in the '
|
||||
'source\n'
|
||||
'code.\n'
|
||||
'even those of the form "*identifier" or "**identifier". (As a '
|
||||
'special\n'
|
||||
'case, parameters of the form "*identifier" may have an '
|
||||
'annotation “":\n'
|
||||
'*expression"”.) Functions may have “return” annotation of the '
|
||||
'form\n'
|
||||
'“"-> expression"” after the parameter list. These annotations '
|
||||
'can be\n'
|
||||
'any valid Python expression. The presence of annotations does '
|
||||
'not\n'
|
||||
'change the semantics of a function. The annotation values are\n'
|
||||
'available as values of a dictionary keyed by the parameters’ '
|
||||
'names in\n'
|
||||
'the "__annotations__" attribute of the function object. If the\n'
|
||||
'"annotations" import from "__future__" is used, annotations are\n'
|
||||
'preserved as strings at runtime which enables postponed '
|
||||
'evaluation.\n'
|
||||
'Otherwise, they are evaluated when the function definition is\n'
|
||||
'executed. In this case annotations may be evaluated in a '
|
||||
'different\n'
|
||||
'order than they appear in the source code.\n'
|
||||
'\n'
|
||||
'Changed in version 3.11: Parameters of the form “"*identifier"” '
|
||||
'may\n'
|
||||
'have an annotation “": *expression"”. See **PEP 646**.\n'
|
||||
'\n'
|
||||
'It is also possible to create anonymous functions (functions not '
|
||||
'bound\n'
|
||||
|
@ -6231,11 +6239,11 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'* While annotation scopes have an internal name, that name is '
|
||||
'not\n'
|
||||
' reflected in the *__qualname__* of objects defined within the '
|
||||
'scope.\n'
|
||||
' Instead, the "__qualname__" of such objects is as if the '
|
||||
'object were\n'
|
||||
' defined in the enclosing scope.\n'
|
||||
' reflected in the *qualified name* of objects defined within '
|
||||
'the\n'
|
||||
' scope. Instead, the "__qualname__" of such objects is as if '
|
||||
'the\n'
|
||||
' object were defined in the enclosing scope.\n'
|
||||
'\n'
|
||||
'Added in version 3.12: Annotation scopes were introduced in '
|
||||
'Python\n'
|
||||
|
@ -6433,12 +6441,17 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'exprlists': 'Expression lists\n'
|
||||
'****************\n'
|
||||
'\n'
|
||||
' expression_list ::= expression ("," expression)* [","]\n'
|
||||
' starred_list ::= starred_item ("," starred_item)* '
|
||||
' starred_expression ::= ["*"] or_expr\n'
|
||||
' flexible_expression ::= assignment_expression | '
|
||||
'starred_expression\n'
|
||||
' flexible_expression_list ::= flexible_expression ("," '
|
||||
'flexible_expression)* [","]\n'
|
||||
' starred_expression_list ::= starred_expression ("," '
|
||||
'starred_expression)* [","]\n'
|
||||
' expression_list ::= expression ("," expression)* '
|
||||
'[","]\n'
|
||||
' starred_expression ::= expression | (starred_item ",")* '
|
||||
'[starred_item]\n'
|
||||
' starred_item ::= assignment_expression | "*" or_expr\n'
|
||||
' yield_list ::= expression_list | '
|
||||
'starred_expression "," [starred_expression_list]\n'
|
||||
'\n'
|
||||
'Except when part of a list or set display, an expression list\n'
|
||||
'containing at least one comma yields a tuple. The length of '
|
||||
|
@ -6457,6 +6470,10 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'Added in version 3.5: Iterable unpacking in expression lists,\n'
|
||||
'originally proposed by **PEP 448**.\n'
|
||||
'\n'
|
||||
'Added in version 3.11: Any item in an expression list may be '
|
||||
'starred.\n'
|
||||
'See **PEP 646**.\n'
|
||||
'\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 '
|
||||
|
@ -7142,18 +7159,22 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'percent sign. |\n'
|
||||
' '
|
||||
'+-----------+------------------------------------------------------------+\n'
|
||||
' | None | For "float" this is the same as "\'g\'", '
|
||||
'except that when |\n'
|
||||
' | | fixed-point notation is used to format the '
|
||||
'result, it |\n'
|
||||
' | None | For "float" this is like the "\'g\'" type, '
|
||||
'except that when |\n'
|
||||
' | | fixed- point notation is used to format '
|
||||
'the result, it |\n'
|
||||
' | | always includes at least one digit past '
|
||||
'the decimal point. |\n'
|
||||
' | | The precision used is as large as needed '
|
||||
'to represent the |\n'
|
||||
' | | given value faithfully. For "Decimal", '
|
||||
'this is the same |\n'
|
||||
' | | as either "\'g\'" or "\'G\'" depending on '
|
||||
'the value of |\n'
|
||||
'the decimal point, |\n'
|
||||
' | | and switches to the scientific notation '
|
||||
'when "exp >= p - |\n'
|
||||
' | | 1". When the precision is not specified, '
|
||||
'the latter will |\n'
|
||||
' | | be as large as needed to represent the '
|
||||
'given value |\n'
|
||||
' | | faithfully. For "Decimal", this is the '
|
||||
'same as either |\n'
|
||||
' | | "\'g\'" or "\'G\'" depending on the value '
|
||||
'of |\n'
|
||||
' | | "context.capitals" for the current decimal '
|
||||
'context. The |\n'
|
||||
' | | overall effect is to match the output of '
|
||||
|
@ -7343,10 +7364,12 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' parameter_list_no_posonly ::= defparameter ("," '
|
||||
'defparameter)* ["," [parameter_list_starargs]]\n'
|
||||
' | parameter_list_starargs\n'
|
||||
' parameter_list_starargs ::= "*" [parameter] ("," '
|
||||
' parameter_list_starargs ::= "*" [star_parameter] ("," '
|
||||
'defparameter)* ["," ["**" parameter [","]]]\n'
|
||||
' | "**" parameter [","]\n'
|
||||
' parameter ::= identifier [":" expression]\n'
|
||||
' star_parameter ::= identifier [":" ["*"] '
|
||||
'expression]\n'
|
||||
' defparameter ::= parameter ["=" expression]\n'
|
||||
' funcname ::= identifier\n'
|
||||
'\n'
|
||||
|
@ -7474,27 +7497,31 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'expression"”\n'
|
||||
'following the parameter name. Any parameter may have an '
|
||||
'annotation,\n'
|
||||
'even those of the form "*identifier" or "**identifier". '
|
||||
'Functions may\n'
|
||||
'have “return” annotation of the form “"-> expression"” after '
|
||||
'the\n'
|
||||
'parameter list. These annotations can be any valid Python '
|
||||
'expression.\n'
|
||||
'The presence of annotations does not change the semantics of a\n'
|
||||
'function. The annotation values are available as values of a\n'
|
||||
'dictionary keyed by the parameters’ names in the '
|
||||
'"__annotations__"\n'
|
||||
'attribute of the function object. If the "annotations" import '
|
||||
'from\n'
|
||||
'"__future__" is used, annotations are preserved as strings at '
|
||||
'runtime\n'
|
||||
'which enables postponed evaluation. Otherwise, they are '
|
||||
'evaluated\n'
|
||||
'when the function definition is executed. In this case '
|
||||
'annotations\n'
|
||||
'may be evaluated in a different order than they appear in the '
|
||||
'source\n'
|
||||
'code.\n'
|
||||
'even those of the form "*identifier" or "**identifier". (As a '
|
||||
'special\n'
|
||||
'case, parameters of the form "*identifier" may have an '
|
||||
'annotation “":\n'
|
||||
'*expression"”.) Functions may have “return” annotation of the '
|
||||
'form\n'
|
||||
'“"-> expression"” after the parameter list. These annotations '
|
||||
'can be\n'
|
||||
'any valid Python expression. The presence of annotations does '
|
||||
'not\n'
|
||||
'change the semantics of a function. The annotation values are\n'
|
||||
'available as values of a dictionary keyed by the parameters’ '
|
||||
'names in\n'
|
||||
'the "__annotations__" attribute of the function object. If the\n'
|
||||
'"annotations" import from "__future__" is used, annotations are\n'
|
||||
'preserved as strings at runtime which enables postponed '
|
||||
'evaluation.\n'
|
||||
'Otherwise, they are evaluated when the function definition is\n'
|
||||
'executed. In this case annotations may be evaluated in a '
|
||||
'different\n'
|
||||
'order than they appear in the source code.\n'
|
||||
'\n'
|
||||
'Changed in version 3.11: Parameters of the form “"*identifier"” '
|
||||
'may\n'
|
||||
'have an annotation “": *expression"”. See **PEP 646**.\n'
|
||||
'\n'
|
||||
'It is also possible to create anonymous functions (functions not '
|
||||
'bound\n'
|
||||
|
@ -8250,7 +8277,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'in\n'
|
||||
'square brackets:\n'
|
||||
'\n'
|
||||
' list_display ::= "[" [starred_list | comprehension] "]"\n'
|
||||
' list_display ::= "[" [flexible_expression_list | comprehension] '
|
||||
'"]"\n'
|
||||
'\n'
|
||||
'A list display yields a new list object, the contents being '
|
||||
'specified\n'
|
||||
|
@ -8501,11 +8529,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' can introduce new names.\n'
|
||||
'\n'
|
||||
'* While annotation scopes have an internal name, that name is not\n'
|
||||
' reflected in the *__qualname__* of objects defined within the '
|
||||
'scope.\n'
|
||||
' Instead, the "__qualname__" of such objects is as if the object '
|
||||
'were\n'
|
||||
' defined in the enclosing scope.\n'
|
||||
' reflected in the *qualified name* of objects defined within the\n'
|
||||
' scope. Instead, the "__qualname__" of such objects is as if the\n'
|
||||
' object were defined in the enclosing scope.\n'
|
||||
'\n'
|
||||
'Added in version 3.12: Annotation scopes were introduced in '
|
||||
'Python\n'
|
||||
|
@ -9721,20 +9747,6 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'not reported\n'
|
||||
'by the "dir()" built-in function.\n'
|
||||
'\n'
|
||||
'object.__dict__\n'
|
||||
'\n'
|
||||
' A dictionary or other mapping object used to store an '
|
||||
'object’s\n'
|
||||
' (writable) attributes.\n'
|
||||
'\n'
|
||||
'instance.__class__\n'
|
||||
'\n'
|
||||
' The class to which a class instance belongs.\n'
|
||||
'\n'
|
||||
'class.__bases__\n'
|
||||
'\n'
|
||||
' The tuple of base classes of a class object.\n'
|
||||
'\n'
|
||||
'definition.__name__\n'
|
||||
'\n'
|
||||
' The name of the class, function, method, descriptor, or '
|
||||
|
@ -9749,39 +9761,26 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' Added in version 3.3.\n'
|
||||
'\n'
|
||||
'definition.__module__\n'
|
||||
'\n'
|
||||
' The name of the module in which a class or function was '
|
||||
'defined.\n'
|
||||
'\n'
|
||||
'definition.__doc__\n'
|
||||
'\n'
|
||||
' The documentation string of a class or function, or '
|
||||
'"None" if\n'
|
||||
' undefined.\n'
|
||||
'\n'
|
||||
'definition.__type_params__\n'
|
||||
'\n'
|
||||
' The type parameters of generic classes, functions, and '
|
||||
'type\n'
|
||||
' aliases.\n'
|
||||
' aliases. For classes and functions that are not generic, '
|
||||
'this will\n'
|
||||
' be an empty tuple.\n'
|
||||
'\n'
|
||||
' Added in version 3.12.\n'
|
||||
'\n'
|
||||
'class.__mro__\n'
|
||||
'\n'
|
||||
' This attribute is a tuple of classes that are considered '
|
||||
'when\n'
|
||||
' looking for base classes during method resolution.\n'
|
||||
'\n'
|
||||
'class.mro()\n'
|
||||
'\n'
|
||||
' This method can be overridden by a metaclass to customize '
|
||||
'the\n'
|
||||
' method resolution order for its instances. It is called '
|
||||
'at class\n'
|
||||
' instantiation, and its result is stored in "__mro__".\n'
|
||||
'\n'
|
||||
'class.__subclasses__()\n'
|
||||
'\n'
|
||||
' Each class keeps a list of weak references to its '
|
||||
'immediate\n'
|
||||
' subclasses. This method returns a list of all those '
|
||||
'references\n'
|
||||
' still alive. The list is in definition order. Example:\n'
|
||||
'\n'
|
||||
' >>> int.__subclasses__()\n'
|
||||
" [<class 'bool'>, <enum 'IntEnum'>, <flag 'IntFlag'>, "
|
||||
"<class 're._constants._NamedIntConstant'>]\n",
|
||||
' Added in version 3.12.\n',
|
||||
'specialnames': 'Special method names\n'
|
||||
'********************\n'
|
||||
'\n'
|
||||
|
@ -10727,11 +10726,13 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'the class\n'
|
||||
' where it is defined. *__slots__* declared in parents are '
|
||||
'available\n'
|
||||
' in child classes. However, child subclasses will get a '
|
||||
'"__dict__"\n'
|
||||
' and *__weakref__* unless they also define *__slots__* '
|
||||
'(which should\n'
|
||||
' only contain names of any *additional* slots).\n'
|
||||
' in child classes. However, instances of a child subclass '
|
||||
'will get a\n'
|
||||
' "__dict__" and *__weakref__* unless the subclass also '
|
||||
'defines\n'
|
||||
' *__slots__* (which should only contain names of any '
|
||||
'*additional*\n'
|
||||
' slots).\n'
|
||||
'\n'
|
||||
'* If a class defines a slot also defined in a base class, '
|
||||
'the instance\n'
|
||||
|
@ -11148,7 +11149,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'built-in\n'
|
||||
'types), including other ABCs.\n'
|
||||
'\n'
|
||||
'class.__instancecheck__(self, instance)\n'
|
||||
'type.__instancecheck__(self, instance)\n'
|
||||
'\n'
|
||||
' Return true if *instance* should be considered a (direct '
|
||||
'or\n'
|
||||
|
@ -11156,7 +11157,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'implement\n'
|
||||
' "isinstance(instance, class)".\n'
|
||||
'\n'
|
||||
'class.__subclasscheck__(self, subclass)\n'
|
||||
'type.__subclasscheck__(self, subclass)\n'
|
||||
'\n'
|
||||
' Return true if *subclass* should be considered a (direct '
|
||||
'or\n'
|
||||
|
@ -13278,7 +13279,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'*generic\n'
|
||||
'class* will generally return a GenericAlias object.\n'
|
||||
'\n'
|
||||
' subscription ::= primary "[" expression_list "]"\n'
|
||||
' subscription ::= primary "[" flexible_expression_list '
|
||||
'"]"\n'
|
||||
'\n'
|
||||
'When an object is subscripted, the interpreter will '
|
||||
'evaluate the\n'
|
||||
|
@ -13297,13 +13299,18 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'see\n'
|
||||
'__class_getitem__ versus __getitem__.\n'
|
||||
'\n'
|
||||
'If the expression list contains at least one comma, it will '
|
||||
'evaluate\n'
|
||||
'to a "tuple" containing the items of the expression list. '
|
||||
'Otherwise,\n'
|
||||
'the expression list will evaluate to the value of the '
|
||||
'list’s sole\n'
|
||||
'member.\n'
|
||||
'If the expression list contains at least one comma, or if '
|
||||
'any of the\n'
|
||||
'expressions are starred, the expression list will evaluate '
|
||||
'to a\n'
|
||||
'"tuple" containing the items of the expression list. '
|
||||
'Otherwise, the\n'
|
||||
'expression list will evaluate to the value of the list’s '
|
||||
'sole member.\n'
|
||||
'\n'
|
||||
'Changed in version 3.11: Expressions in an expression list '
|
||||
'may be\n'
|
||||
'starred. See **PEP 646**.\n'
|
||||
'\n'
|
||||
'For built-in objects, there are two types of objects that '
|
||||
'support\n'
|
||||
|
@ -14052,8 +14059,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'|====================================================|====================================================|\n'
|
||||
'| function.__doc__ | The '
|
||||
'function’s documentation string, or "None" if |\n'
|
||||
'| | unavailable. '
|
||||
'Not inherited by subclasses. |\n'
|
||||
'| | '
|
||||
'unavailable. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| function.__name__ | The '
|
||||
'function’s name. See also: "__name__ |\n'
|
||||
|
@ -14423,32 +14430,104 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'A class object can be called (see above) to yield a class instance\n'
|
||||
'(see below).\n'
|
||||
'\n'
|
||||
'Special attributes:\n'
|
||||
'\n'
|
||||
' "__name__"\n'
|
||||
' The class name.\n'
|
||||
'Special attributes\n'
|
||||
'------------------\n'
|
||||
'\n'
|
||||
' "__module__"\n'
|
||||
' The name of the module in which the class was defined.\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| Attribute | '
|
||||
'Meaning |\n'
|
||||
'|====================================================|====================================================|\n'
|
||||
'| type.__name__ | The class’s '
|
||||
'name. See also: "__name__ attributes". |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| type.__qualname__ | The class’s '
|
||||
'*qualified name*. See also: |\n'
|
||||
'| | '
|
||||
'"__qualname__ attributes". |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| type.__module__ | The name of '
|
||||
'the module in which the class was |\n'
|
||||
'| | '
|
||||
'defined. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| type.__dict__ | A "mapping '
|
||||
'proxy" providing a read-only view of |\n'
|
||||
'| | the class’s '
|
||||
'namespace. See also: "__dict__ |\n'
|
||||
'| | '
|
||||
'attributes". |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| type.__bases__ | A "tuple" '
|
||||
'containing the class’s bases. In most |\n'
|
||||
'| | cases, for a '
|
||||
'class defined as "class X(A, B, C)", |\n'
|
||||
'| | '
|
||||
'"X.__bases__" will be exactly equal to "(A, B, |\n'
|
||||
'| | '
|
||||
'C)". |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| type.__doc__ | The class’s '
|
||||
'documentation string, or "None" if |\n'
|
||||
'| | undefined. '
|
||||
'Not inherited by subclasses. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| type.__annotations__ | A dictionary '
|
||||
'containing *variable annotations* |\n'
|
||||
'| | collected '
|
||||
'during class body execution. For best |\n'
|
||||
'| | practices on '
|
||||
'working with "__annotations__", |\n'
|
||||
'| | please see '
|
||||
'Annotations Best Practices. Caution: |\n'
|
||||
'| | Accessing '
|
||||
'the "__annotations__" attribute of a |\n'
|
||||
'| | class object '
|
||||
'directly may yield incorrect results |\n'
|
||||
'| | in the '
|
||||
'presence of metaclasses. In addition, the |\n'
|
||||
'| | attribute '
|
||||
'may not exist for some classes. Use |\n'
|
||||
'| | '
|
||||
'"inspect.get_annotations()" to retrieve class |\n'
|
||||
'| | annotations '
|
||||
'safely. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| type.__type_params__ | A "tuple" '
|
||||
'containing the type parameters of a |\n'
|
||||
'| | generic '
|
||||
'class. Added in version 3.12. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'| type.__mro__ | The "tuple" '
|
||||
'of classes that are considered when |\n'
|
||||
'| | looking for '
|
||||
'base classes during method resolution. |\n'
|
||||
'+----------------------------------------------------+----------------------------------------------------+\n'
|
||||
'\n'
|
||||
' "__dict__"\n'
|
||||
' The dictionary containing the class’s namespace.\n'
|
||||
'\n'
|
||||
' "__bases__"\n'
|
||||
' A tuple containing the base classes, in the order of their\n'
|
||||
' occurrence in the base class list.\n'
|
||||
'Special methods\n'
|
||||
'---------------\n'
|
||||
'\n'
|
||||
' "__doc__"\n'
|
||||
' The class’s documentation string, or "None" if undefined.\n'
|
||||
'In addition to the special attributes described above, all Python\n'
|
||||
'classes also have the following two methods available:\n'
|
||||
'\n'
|
||||
' "__annotations__"\n'
|
||||
' A dictionary containing *variable annotations* collected '
|
||||
'during\n'
|
||||
' class body execution. For best practices on working with\n'
|
||||
' "__annotations__", please see Annotations Best Practices.\n'
|
||||
'type.mro()\n'
|
||||
'\n'
|
||||
' "__type_params__"\n'
|
||||
' A tuple containing the type parameters of a generic class.\n'
|
||||
' This method can be overridden by a metaclass to customize the\n'
|
||||
' method resolution order for its instances. It is called at '
|
||||
'class\n'
|
||||
' instantiation, and its result is stored in "__mro__".\n'
|
||||
'\n'
|
||||
'type.__subclasses__()\n'
|
||||
'\n'
|
||||
' Each class keeps a list of weak references to its immediate\n'
|
||||
' subclasses. This method returns a list of all those references\n'
|
||||
' still alive. The list is in definition order. Example:\n'
|
||||
'\n'
|
||||
' >>> class A: pass\n'
|
||||
' >>> class B(A): pass\n'
|
||||
' >>> A.__subclasses__()\n'
|
||||
" [<class 'B'>]\n"
|
||||
'\n'
|
||||
'\n'
|
||||
'Class instances\n'
|
||||
|
@ -14488,8 +14567,19 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'they have methods with certain special names. See section Special\n'
|
||||
'method names.\n'
|
||||
'\n'
|
||||
'Special attributes: "__dict__" is the attribute dictionary;\n'
|
||||
'"__class__" is the instance’s class.\n'
|
||||
'\n'
|
||||
'Special attributes\n'
|
||||
'------------------\n'
|
||||
'\n'
|
||||
'object.__class__\n'
|
||||
'\n'
|
||||
' The class to which a class instance belongs.\n'
|
||||
'\n'
|
||||
'object.__dict__\n'
|
||||
'\n'
|
||||
' A dictionary or other mapping object used to store an object’s\n'
|
||||
' (writable) attributes. Not all instances have a "__dict__"\n'
|
||||
' attribute; see the section on __slots__ for more details.\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'I/O objects (also known as file objects)\n'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue