mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
Python 3.11.0a7
This commit is contained in:
parent
c1d93b6411
commit
2e49bd06c5
159 changed files with 1750 additions and 474 deletions
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Autogenerated by Sphinx on Mon Mar 7 12:29:42 2022
|
||||
# Autogenerated by Sphinx on Tue Apr 5 20:53:43 2022
|
||||
topics = {'assert': 'The "assert" statement\n'
|
||||
'**********************\n'
|
||||
'\n'
|
||||
|
@ -93,11 +93,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' optionally in parentheses, the object is assigned to that '
|
||||
'target.\n'
|
||||
'\n'
|
||||
'* Else: The object must be an iterable with the same number of '
|
||||
'items\n'
|
||||
' as there are targets in the target list, and the items are '
|
||||
'assigned,\n'
|
||||
' from left to right, to the corresponding targets.\n'
|
||||
'* Else:\n'
|
||||
'\n'
|
||||
' * If the target list contains one target prefixed with an '
|
||||
'asterisk,\n'
|
||||
|
@ -2328,27 +2324,18 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' for_stmt ::= "for" target_list "in" starred_list ":" suite\n'
|
||||
' ["else" ":" suite]\n'
|
||||
'\n'
|
||||
'The expression list is evaluated once; it should yield an '
|
||||
'iterable\n'
|
||||
'object. An iterator is created for the result of the '
|
||||
'"starred_list".\n'
|
||||
'The expression list can contain starred elements ("*x, *y") that '
|
||||
'will\n'
|
||||
'be unpacked in the final iterator (as when constructing a '
|
||||
'"tuple" or\n'
|
||||
'"list" literal). The suite is then executed once for each item\n'
|
||||
'provided by the iterator, in the order returned by the '
|
||||
'iterator. Each\n'
|
||||
'item in turn is assigned to the target list using the standard '
|
||||
'rules\n'
|
||||
'for assignments (see Assignment statements), and then the suite '
|
||||
'is\n'
|
||||
'executed. When the items are exhausted (which is immediately '
|
||||
'when the\n'
|
||||
'sequence is empty or an iterator raises a "StopIteration" '
|
||||
'exception),\n'
|
||||
'the suite in the "else" clause, if present, is executed, and the '
|
||||
'loop\n'
|
||||
'The "starred_list" expression is evaluated once; it should yield '
|
||||
'an\n'
|
||||
'*iterable* object. An *iterator* is created for that iterable. '
|
||||
'The\n'
|
||||
'first item provided by the iterator is then assigned to the '
|
||||
'target\n'
|
||||
'list using the standard rules for assignments (see Assignment\n'
|
||||
'statements), and the suite is executed. This repeats for each '
|
||||
'item\n'
|
||||
'provided by the iterator. When the iterator is exhausted, the '
|
||||
'suite\n'
|
||||
'in the "else" clause, if present, is executed, and the loop\n'
|
||||
'terminates.\n'
|
||||
'\n'
|
||||
'A "break" statement executed in the first suite terminates the '
|
||||
|
@ -2427,11 +2414,11 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'resulting\n'
|
||||
'object is “compatible” with the exception. An object is '
|
||||
'compatible\n'
|
||||
'with an exception if the object is the class or a base class of '
|
||||
'the\n'
|
||||
'exception object, or a tuple containing an item that is the '
|
||||
'class or a\n'
|
||||
'base class of the exception object.\n'
|
||||
'with an exception if the object is the class or a *non-virtual '
|
||||
'base\n'
|
||||
'class* of the exception object, or a tuple containing an item '
|
||||
'that is\n'
|
||||
'the class or a non-virtual base class of the exception object.\n'
|
||||
'\n'
|
||||
'If no except clause matches the exception, the search for an '
|
||||
'exception\n'
|
||||
|
@ -4461,15 +4448,17 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'on members\n'
|
||||
' of hashed collections including "set", "frozenset", and '
|
||||
'"dict".\n'
|
||||
' "__hash__()" should return an integer. The only required '
|
||||
'property\n'
|
||||
' is that objects which compare equal have the same hash '
|
||||
'value; it is\n'
|
||||
' advised to mix together the hash values of the '
|
||||
'components of the\n'
|
||||
' object that also play a part in comparison of objects by '
|
||||
'packing\n'
|
||||
' them into a tuple and hashing the tuple. Example:\n'
|
||||
' The "__hash__()" method should return an integer. The '
|
||||
'only required\n'
|
||||
' property is that objects which compare equal have the '
|
||||
'same hash\n'
|
||||
' value; it is advised to mix together the hash values of '
|
||||
'the\n'
|
||||
' components of the object that also play a part in '
|
||||
'comparison of\n'
|
||||
' objects by packing them into a tuple and hashing the '
|
||||
'tuple.\n'
|
||||
' Example:\n'
|
||||
'\n'
|
||||
' def __hash__(self):\n'
|
||||
' return hash((self.name, self.nick, self.color))\n'
|
||||
|
@ -5458,11 +5447,11 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'clause is\n'
|
||||
'selected depending on the class of the instance: it must '
|
||||
'reference the\n'
|
||||
'class of the instance or a base class thereof. The instance '
|
||||
'can be\n'
|
||||
'received by the handler and can carry additional information '
|
||||
'about the\n'
|
||||
'exceptional condition.\n'
|
||||
'class of the instance or a *non-virtual base class* thereof. '
|
||||
'The\n'
|
||||
'instance can be received by the handler and can carry '
|
||||
'additional\n'
|
||||
'information about the exceptional condition.\n'
|
||||
'\n'
|
||||
'Note:\n'
|
||||
'\n'
|
||||
|
@ -5797,11 +5786,11 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'clause is\n'
|
||||
'selected depending on the class of the instance: it must '
|
||||
'reference the\n'
|
||||
'class of the instance or a base class thereof. The instance '
|
||||
'can be\n'
|
||||
'received by the handler and can carry additional information '
|
||||
'about the\n'
|
||||
'exceptional condition.\n'
|
||||
'class of the instance or a *non-virtual base class* thereof. '
|
||||
'The\n'
|
||||
'instance can be received by the handler and can carry '
|
||||
'additional\n'
|
||||
'information about the exceptional condition.\n'
|
||||
'\n'
|
||||
'Note:\n'
|
||||
'\n'
|
||||
|
@ -5901,23 +5890,13 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' for_stmt ::= "for" target_list "in" starred_list ":" suite\n'
|
||||
' ["else" ":" suite]\n'
|
||||
'\n'
|
||||
'The expression list is evaluated once; it should yield an iterable\n'
|
||||
'object. An iterator is created for the result of the '
|
||||
'"starred_list".\n'
|
||||
'The expression list can contain starred elements ("*x, *y") that '
|
||||
'will\n'
|
||||
'be unpacked in the final iterator (as when constructing a "tuple" or\n'
|
||||
'"list" literal). The suite is then executed once for each item\n'
|
||||
'provided by the iterator, in the order returned by the iterator. '
|
||||
'Each\n'
|
||||
'item in turn is assigned to the target list using the standard rules\n'
|
||||
'for assignments (see Assignment statements), and then the suite is\n'
|
||||
'executed. When the items are exhausted (which is immediately when '
|
||||
'the\n'
|
||||
'sequence is empty or an iterator raises a "StopIteration" '
|
||||
'exception),\n'
|
||||
'the suite in the "else" clause, if present, is executed, and the '
|
||||
'loop\n'
|
||||
'The "starred_list" expression is evaluated once; it should yield an\n'
|
||||
'*iterable* object. An *iterator* is created for that iterable. The\n'
|
||||
'first item provided by the iterator is then assigned to the target\n'
|
||||
'list using the standard rules for assignments (see Assignment\n'
|
||||
'statements), and the suite is executed. This repeats for each item\n'
|
||||
'provided by the iterator. When the iterator is exhausted, the suite\n'
|
||||
'in the "else" clause, if present, is executed, and the loop\n'
|
||||
'terminates.\n'
|
||||
'\n'
|
||||
'A "break" statement executed in the first suite terminates the loop\n'
|
||||
|
@ -9388,15 +9367,17 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'on members\n'
|
||||
' of hashed collections including "set", "frozenset", and '
|
||||
'"dict".\n'
|
||||
' "__hash__()" should return an integer. The only required '
|
||||
'property\n'
|
||||
' is that objects which compare equal have the same hash '
|
||||
'value; it is\n'
|
||||
' advised to mix together the hash values of the components '
|
||||
'of the\n'
|
||||
' object that also play a part in comparison of objects by '
|
||||
'packing\n'
|
||||
' them into a tuple and hashing the tuple. Example:\n'
|
||||
' The "__hash__()" method should return an integer. The '
|
||||
'only required\n'
|
||||
' property is that objects which compare equal have the '
|
||||
'same hash\n'
|
||||
' value; it is advised to mix together the hash values of '
|
||||
'the\n'
|
||||
' components of the object that also play a part in '
|
||||
'comparison of\n'
|
||||
' objects by packing them into a tuple and hashing the '
|
||||
'tuple.\n'
|
||||
' Example:\n'
|
||||
'\n'
|
||||
' def __hash__(self):\n'
|
||||
' return hash((self.name, self.nick, self.color))\n'
|
||||
|
@ -10003,14 +9984,14 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'Whenever a class inherits from another class, '
|
||||
'"__init_subclass__()" is\n'
|
||||
'called on that class. This way, it is possible to write '
|
||||
'classes which\n'
|
||||
'change the behavior of subclasses. This is closely related '
|
||||
'to class\n'
|
||||
'decorators, but where class decorators only affect the '
|
||||
'specific class\n'
|
||||
'they’re applied to, "__init_subclass__" solely applies to '
|
||||
'future\n'
|
||||
'called on the parent class. This way, it is possible to '
|
||||
'write classes\n'
|
||||
'which change the behavior of subclasses. This is closely '
|
||||
'related to\n'
|
||||
'class decorators, but where class decorators only affect the '
|
||||
'specific\n'
|
||||
'class they’re applied to, "__init_subclass__" solely applies '
|
||||
'to future\n'
|
||||
'subclasses of the class defining the method.\n'
|
||||
'\n'
|
||||
'classmethod object.__init_subclass__(cls)\n'
|
||||
|
@ -12381,67 +12362,86 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'subscriptions': 'Subscriptions\n'
|
||||
'*************\n'
|
||||
'\n'
|
||||
'Subscription of a sequence (string, tuple or list) or '
|
||||
'mapping\n'
|
||||
'(dictionary) object usually selects an item from the '
|
||||
'collection:\n'
|
||||
'The subscription of an instance of a container class will '
|
||||
'generally\n'
|
||||
'select an element from the container. The subscription of a '
|
||||
'*generic\n'
|
||||
'class* will generally return a GenericAlias object.\n'
|
||||
'\n'
|
||||
' subscription ::= primary "[" expression_list "]"\n'
|
||||
'\n'
|
||||
'When an object is subscripted, the interpreter will '
|
||||
'evaluate the\n'
|
||||
'primary and the expression list.\n'
|
||||
'\n'
|
||||
'The primary must evaluate to an object that supports '
|
||||
'subscription\n'
|
||||
'(lists or dictionaries for example). User-defined objects '
|
||||
'can support\n'
|
||||
'subscription by defining a "__getitem__()" method.\n'
|
||||
'subscription. An\n'
|
||||
'object may support subscription through defining one or '
|
||||
'both of\n'
|
||||
'"__getitem__()" and "__class_getitem__()". When the primary '
|
||||
'is\n'
|
||||
'subscripted, the evaluated result of the expression list '
|
||||
'will be\n'
|
||||
'passed to one of these methods. For more details on when\n'
|
||||
'"__class_getitem__" is called instead of "__getitem__", '
|
||||
'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'
|
||||
'\n'
|
||||
'For built-in objects, there are two types of objects that '
|
||||
'support\n'
|
||||
'subscription:\n'
|
||||
'subscription via "__getitem__()":\n'
|
||||
'\n'
|
||||
'If the primary is a mapping, the expression list must '
|
||||
'evaluate to an\n'
|
||||
'object whose value is one of the keys of the mapping, and '
|
||||
'1. Mappings. If the primary is a *mapping*, the expression '
|
||||
'list must\n'
|
||||
' evaluate to an object whose value is one of the keys of '
|
||||
'the\n'
|
||||
'subscription selects the value in the mapping that '
|
||||
'corresponds to that\n'
|
||||
'key. (The expression list is a tuple except if it has '
|
||||
'exactly one\n'
|
||||
'item.)\n'
|
||||
' mapping, and the subscription selects the value in the '
|
||||
'mapping that\n'
|
||||
' corresponds to that key. An example of a builtin mapping '
|
||||
'class is\n'
|
||||
' the "dict" class.\n'
|
||||
'\n'
|
||||
'If the primary is a sequence, the expression list must '
|
||||
'evaluate to an\n'
|
||||
'integer or a slice (as discussed in the following '
|
||||
'section).\n'
|
||||
'2. Sequences. If the primary is a *sequence*, the '
|
||||
'expression list must\n'
|
||||
' evaluate to an "int" or a "slice" (as discussed in the '
|
||||
'following\n'
|
||||
' section). Examples of builtin sequence classes include '
|
||||
'the "str",\n'
|
||||
' "list" and "tuple" classes.\n'
|
||||
'\n'
|
||||
'The formal syntax makes no special provision for negative '
|
||||
'indices in\n'
|
||||
'sequences; however, built-in sequences all provide a '
|
||||
'*sequences*. However, built-in sequences all provide a '
|
||||
'"__getitem__()"\n'
|
||||
'method that interprets negative indices by adding the '
|
||||
'length of the\n'
|
||||
'sequence to the index (so that "x[-1]" selects the last '
|
||||
'item of "x").\n'
|
||||
'The resulting value must be a nonnegative integer less than '
|
||||
'the number\n'
|
||||
'of items in the sequence, and the subscription selects the '
|
||||
'item whose\n'
|
||||
'index is that value (counting from zero). Since the support '
|
||||
'for\n'
|
||||
'negative indices and slicing occurs in the object’s '
|
||||
'"__getitem__()"\n'
|
||||
'method, subclasses overriding this method will need to '
|
||||
'explicitly add\n'
|
||||
'that support.\n'
|
||||
'sequence to the index so that, for example, "x[-1]" selects '
|
||||
'the last\n'
|
||||
'item of "x". The resulting value must be a nonnegative '
|
||||
'integer less\n'
|
||||
'than the number of items in the sequence, and the '
|
||||
'subscription selects\n'
|
||||
'the item whose index is that value (counting from zero). '
|
||||
'Since the\n'
|
||||
'support for negative indices and slicing occurs in the '
|
||||
'object’s\n'
|
||||
'"__getitem__()" method, subclasses overriding this method '
|
||||
'will need to\n'
|
||||
'explicitly add that support.\n'
|
||||
'\n'
|
||||
'A string’s items are characters. A character is not a '
|
||||
'separate data\n'
|
||||
'type but a string of exactly one character.\n'
|
||||
'\n'
|
||||
'Subscription of certain *classes* or *types* creates a '
|
||||
'generic alias.\n'
|
||||
'In this case, user-defined classes can support subscription '
|
||||
'by\n'
|
||||
'providing a "__class_getitem__()" classmethod.\n',
|
||||
'A "string" is a special kind of sequence whose items are '
|
||||
'*characters*.\n'
|
||||
'A character is not a separate data type but a string of '
|
||||
'exactly one\n'
|
||||
'character.\n',
|
||||
'truth': 'Truth Value Testing\n'
|
||||
'*******************\n'
|
||||
'\n'
|
||||
|
@ -12502,10 +12502,10 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'exception. For an except clause with an expression, that expression\n'
|
||||
'is evaluated, and the clause matches the exception if the resulting\n'
|
||||
'object is “compatible” with the exception. An object is compatible\n'
|
||||
'with an exception if the object is the class or a base class of the\n'
|
||||
'exception object, or a tuple containing an item that is the class or '
|
||||
'a\n'
|
||||
'base class of the exception object.\n'
|
||||
'with an exception if the object is the class or a *non-virtual base\n'
|
||||
'class* of the exception object, or a tuple containing an item that '
|
||||
'is\n'
|
||||
'the class or a non-virtual base class of the exception object.\n'
|
||||
'\n'
|
||||
'If no except clause matches the exception, the search for an '
|
||||
'exception\n'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue