mirror of
https://github.com/python/cpython.git
synced 2025-07-30 14:44:10 +00:00
Python 3.10.2
This commit is contained in:
parent
3ce6945f5f
commit
a58ebcc701
43 changed files with 620 additions and 333 deletions
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Autogenerated by Sphinx on Mon Dec 6 17:57:38 2021
|
||||
# Autogenerated by Sphinx on Thu Jan 13 18:49:56 2022
|
||||
topics = {'assert': 'The "assert" statement\n'
|
||||
'**********************\n'
|
||||
'\n'
|
||||
|
@ -1007,7 +1007,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'"super(B,\n'
|
||||
' obj).m()" searches "obj.__class__.__mro__" for the '
|
||||
'base class "A"\n'
|
||||
' immediately preceding "B" and then invokes the '
|
||||
' immediately following "B" and then invokes the '
|
||||
'descriptor with the\n'
|
||||
' call: "A.__dict__[\'m\'].__get__(obj, '
|
||||
'obj.__class__)".\n'
|
||||
|
@ -1038,14 +1038,15 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'can be\n'
|
||||
'overridden by instances.\n'
|
||||
'\n'
|
||||
'Python methods (including "staticmethod()" and '
|
||||
'"classmethod()") are\n'
|
||||
'implemented as non-data descriptors. Accordingly, '
|
||||
'instances can\n'
|
||||
'redefine and override methods. This allows individual '
|
||||
'instances to\n'
|
||||
'acquire behaviors that differ from other instances of '
|
||||
'the same class.\n'
|
||||
'Python methods (including those decorated with '
|
||||
'"@staticmethod" and\n'
|
||||
'"@classmethod") are implemented as non-data '
|
||||
'descriptors. Accordingly,\n'
|
||||
'instances can redefine and override methods. This '
|
||||
'allows individual\n'
|
||||
'instances to acquire behaviors that differ from other '
|
||||
'instances of the\n'
|
||||
'same class.\n'
|
||||
'\n'
|
||||
'The "property()" function is implemented as a data '
|
||||
'descriptor.\n'
|
||||
|
@ -1058,12 +1059,12 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'*__slots__* allow us to explicitly declare data members '
|
||||
'(like\n'
|
||||
'properties) and deny the creation of *__dict__* and '
|
||||
'properties) and deny the creation of "__dict__" and '
|
||||
'*__weakref__*\n'
|
||||
'(unless explicitly declared in *__slots__* or available '
|
||||
'in a parent.)\n'
|
||||
'\n'
|
||||
'The space saved over using *__dict__* can be '
|
||||
'The space saved over using "__dict__" can be '
|
||||
'significant. Attribute\n'
|
||||
'lookup speed can be significantly improved as well.\n'
|
||||
'\n'
|
||||
|
@ -1075,7 +1076,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'*__slots__*\n'
|
||||
' reserves space for the declared variables and '
|
||||
'prevents the\n'
|
||||
' automatic creation of *__dict__* and *__weakref__* '
|
||||
' automatic creation of "__dict__" and *__weakref__* '
|
||||
'for each\n'
|
||||
' instance.\n'
|
||||
'\n'
|
||||
|
@ -1084,11 +1085,11 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'--------------------------\n'
|
||||
'\n'
|
||||
'* When inheriting from a class without *__slots__*, the '
|
||||
'*__dict__* and\n'
|
||||
'"__dict__" and\n'
|
||||
' *__weakref__* attribute of the instances will always '
|
||||
'be accessible.\n'
|
||||
'\n'
|
||||
'* Without a *__dict__* variable, instances cannot be '
|
||||
'* Without a "__dict__" variable, instances cannot be '
|
||||
'assigned new\n'
|
||||
' variables not listed in the *__slots__* definition. '
|
||||
'Attempts to\n'
|
||||
|
@ -1102,28 +1103,28 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'* Without a *__weakref__* variable for each instance, '
|
||||
'classes defining\n'
|
||||
' *__slots__* do not support weak references to its '
|
||||
'instances. If weak\n'
|
||||
' reference support is needed, then add '
|
||||
' *__slots__* do not support "weak references" to its '
|
||||
'instances. If\n'
|
||||
' weak reference support is needed, then add '
|
||||
'"\'__weakref__\'" to the\n'
|
||||
' sequence of strings in the *__slots__* declaration.\n'
|
||||
'\n'
|
||||
'* *__slots__* are implemented at the class level by '
|
||||
'creating\n'
|
||||
' descriptors (Implementing Descriptors) for each '
|
||||
'variable name. As a\n'
|
||||
' result, class attributes cannot be used to set default '
|
||||
'values for\n'
|
||||
' instance variables defined by *__slots__*; otherwise, '
|
||||
'the class\n'
|
||||
' attribute would overwrite the descriptor assignment.\n'
|
||||
' descriptors for each variable name. As a result, '
|
||||
'class attributes\n'
|
||||
' cannot be used to set default values for instance '
|
||||
'variables defined\n'
|
||||
' by *__slots__*; otherwise, the class attribute would '
|
||||
'overwrite the\n'
|
||||
' descriptor assignment.\n'
|
||||
'\n'
|
||||
'* The action of a *__slots__* declaration is not limited '
|
||||
'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'
|
||||
'"__dict__"\n'
|
||||
' and *__weakref__* unless they also define *__slots__* '
|
||||
'(which should\n'
|
||||
' only contain names of any *additional* slots).\n'
|
||||
|
@ -1143,13 +1144,19 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' “variable-length” built-in types such as "int", '
|
||||
'"bytes" and "tuple".\n'
|
||||
'\n'
|
||||
'* Any non-string iterable may be assigned to '
|
||||
'*__slots__*. Mappings may\n'
|
||||
' also be used; however, in the future, special meaning '
|
||||
'may be\n'
|
||||
' assigned to the values corresponding to each key.\n'
|
||||
'* Any non-string *iterable* may be assigned to '
|
||||
'*__slots__*.\n'
|
||||
'\n'
|
||||
'* *__class__* assignment works only if both classes have '
|
||||
'* If a "dictionary" is used to assign *__slots__*, the '
|
||||
'dictionary keys\n'
|
||||
' will be used as the slot names. The values of the '
|
||||
'dictionary can be\n'
|
||||
' used to provide per-attribute docstrings that will be '
|
||||
'recognised by\n'
|
||||
' "inspect.getdoc()" and displayed in the output of '
|
||||
'"help()".\n'
|
||||
'\n'
|
||||
'* "__class__" assignment works only if both classes have '
|
||||
'the same\n'
|
||||
' *__slots__*.\n'
|
||||
'\n'
|
||||
|
@ -1161,10 +1168,10 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'violations\n'
|
||||
' raise "TypeError".\n'
|
||||
'\n'
|
||||
'* If an iterator is used for *__slots__* then a '
|
||||
'descriptor is created\n'
|
||||
' for each of the iterator’s values. However, the '
|
||||
'*__slots__*\n'
|
||||
'* If an *iterator* is used for *__slots__* then a '
|
||||
'*descriptor* is\n'
|
||||
' created for each of the iterator’s values. However, '
|
||||
'the *__slots__*\n'
|
||||
' attribute will be an empty iterator.\n',
|
||||
'attribute-references': 'Attribute references\n'
|
||||
'********************\n'
|
||||
|
@ -2378,33 +2385,6 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
':= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, '
|
||||
'2]".\n'
|
||||
'\n'
|
||||
'Note:\n'
|
||||
'\n'
|
||||
' There is a subtlety when the sequence is being modified by the '
|
||||
'loop\n'
|
||||
' (this can only occur for mutable sequences, e.g. lists). An\n'
|
||||
' internal counter is used to keep track of which item is used '
|
||||
'next,\n'
|
||||
' and this is incremented on each iteration. When this counter '
|
||||
'has\n'
|
||||
' reached the length of the sequence the loop terminates. This '
|
||||
'means\n'
|
||||
' that if the suite deletes the current (or a previous) item '
|
||||
'from the\n'
|
||||
' sequence, the next item will be skipped (since it gets the '
|
||||
'index of\n'
|
||||
' the current item which has already been treated). Likewise, '
|
||||
'if the\n'
|
||||
' suite inserts an item in the sequence before the current item, '
|
||||
'the\n'
|
||||
' current item will be treated again the next time through the '
|
||||
'loop.\n'
|
||||
' This can lead to nasty bugs that can be avoided by making a\n'
|
||||
' temporary copy using a slice of the whole sequence, e.g.,\n'
|
||||
'\n'
|
||||
' for x in a[:]:\n'
|
||||
' if x < 0: a.remove(x)\n'
|
||||
'\n'
|
||||
'\n'
|
||||
'The "try" statement\n'
|
||||
'===================\n'
|
||||
|
@ -4622,17 +4602,16 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'debugger will pause execution just before the first line of the\n'
|
||||
'module.\n'
|
||||
'\n'
|
||||
'The typical usage to break into the debugger from a running '
|
||||
'program is\n'
|
||||
'to insert\n'
|
||||
'The typical usage to break into the debugger is to insert:\n'
|
||||
'\n'
|
||||
' import pdb; pdb.set_trace()\n'
|
||||
'\n'
|
||||
'at the location you want to break into the debugger. You can '
|
||||
'then\n'
|
||||
'step through the code following this statement, and continue '
|
||||
'running\n'
|
||||
'without the debugger using the "continue" command.\n'
|
||||
'at the location you want to break into the debugger, and then '
|
||||
'run the\n'
|
||||
'program. You can then step through the code following this '
|
||||
'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 '
|
||||
'with\n'
|
||||
|
@ -5894,30 +5873,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'all by the loop. Hint: the built-in function "range()" returns an\n'
|
||||
'iterator of integers suitable to emulate the effect of Pascal’s "for '
|
||||
'i\n'
|
||||
':= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, 2]".\n'
|
||||
'\n'
|
||||
'Note:\n'
|
||||
'\n'
|
||||
' There is a subtlety when the sequence is being modified by the '
|
||||
'loop\n'
|
||||
' (this can only occur for mutable sequences, e.g. lists). An\n'
|
||||
' internal counter is used to keep track of which item is used next,\n'
|
||||
' and this is incremented on each iteration. When this counter has\n'
|
||||
' reached the length of the sequence the loop terminates. This '
|
||||
'means\n'
|
||||
' that if the suite deletes the current (or a previous) item from '
|
||||
'the\n'
|
||||
' sequence, the next item will be skipped (since it gets the index '
|
||||
'of\n'
|
||||
' the current item which has already been treated). Likewise, if '
|
||||
'the\n'
|
||||
' suite inserts an item in the sequence before the current item, the\n'
|
||||
' current item will be treated again the next time through the loop.\n'
|
||||
' This can lead to nasty bugs that can be avoided by making a\n'
|
||||
' temporary copy using a slice of the whole sequence, e.g.,\n'
|
||||
'\n'
|
||||
' for x in a[:]:\n'
|
||||
' if x < 0: a.remove(x)\n',
|
||||
':= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, 2]".\n',
|
||||
'formatstrings': 'Format String Syntax\n'
|
||||
'********************\n'
|
||||
'\n'
|
||||
|
@ -8574,61 +8530,62 @@ 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 mappings\n'
|
||||
'(like dictionaries), but can represent other containers as '
|
||||
'well. The\n'
|
||||
'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 '
|
||||
'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" '
|
||||
'objects.\n'
|
||||
'The "collections.abc" module provides a "MutableMapping" '
|
||||
'abstract base\n'
|
||||
'class to help create those methods from a base set of '
|
||||
'"__getitem__()",\n'
|
||||
'"__setitem__()", "__delitem__()", and "keys()". Mutable '
|
||||
'sequences\n'
|
||||
'should provide methods "append()", "count()", "index()", '
|
||||
'"extend()",\n'
|
||||
'"insert()", "pop()", "remove()", "reverse()" and "sort()", '
|
||||
'like Python\n'
|
||||
'standard list objects. Finally, sequence types should '
|
||||
'implement\n'
|
||||
'addition (meaning concatenation) and multiplication '
|
||||
'Finally, sequence types should implement addition '
|
||||
'(meaning\n'
|
||||
'repetition) by defining the methods "__add__()", '
|
||||
'"__radd__()",\n'
|
||||
'"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" '
|
||||
'described\n'
|
||||
'below; they should not define other numerical operators. '
|
||||
'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'
|
||||
'recommended that both mappings and sequences implement '
|
||||
'further recommended that both mappings and sequences '
|
||||
'implement the\n'
|
||||
'"__iter__()" method to allow efficient iteration through '
|
||||
'the\n'
|
||||
'"__contains__()" method to allow efficient use of the "in" '
|
||||
'operator;\n'
|
||||
'for mappings, "in" should search the mapping’s keys; for '
|
||||
'sequences, it\n'
|
||||
'should search through the values. It is further '
|
||||
'recommended that both\n'
|
||||
'mappings and sequences implement the "__iter__()" method '
|
||||
'to allow\n'
|
||||
'efficient iteration through the container; for mappings, '
|
||||
'"__iter__()"\n'
|
||||
'should iterate through the object’s keys; for sequences, '
|
||||
'it should\n'
|
||||
'iterate through the values.\n'
|
||||
'container; for mappings, "__iter__()" should iterate '
|
||||
'through the\n'
|
||||
'object’s keys; for sequences, it should iterate through '
|
||||
'the values.\n'
|
||||
'\n'
|
||||
'object.__len__(self)\n'
|
||||
'\n'
|
||||
|
@ -9789,7 +9746,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'"super(B,\n'
|
||||
' obj).m()" searches "obj.__class__.__mro__" for the base '
|
||||
'class "A"\n'
|
||||
' immediately preceding "B" and then invokes the descriptor '
|
||||
' immediately following "B" and then invokes the descriptor '
|
||||
'with the\n'
|
||||
' call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n'
|
||||
'\n'
|
||||
|
@ -9819,13 +9776,14 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'be\n'
|
||||
'overridden by instances.\n'
|
||||
'\n'
|
||||
'Python methods (including "staticmethod()" and '
|
||||
'"classmethod()") are\n'
|
||||
'implemented as non-data descriptors. Accordingly, instances '
|
||||
'can\n'
|
||||
'redefine and override methods. This allows individual '
|
||||
'instances to\n'
|
||||
'acquire behaviors that differ from other instances of the '
|
||||
'Python methods (including those decorated with '
|
||||
'"@staticmethod" and\n'
|
||||
'"@classmethod") are implemented as non-data descriptors. '
|
||||
'Accordingly,\n'
|
||||
'instances can redefine and override methods. This allows '
|
||||
'individual\n'
|
||||
'instances to acquire behaviors that differ from other '
|
||||
'instances of the\n'
|
||||
'same class.\n'
|
||||
'\n'
|
||||
'The "property()" function is implemented as a data '
|
||||
|
@ -9839,12 +9797,12 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'*__slots__* allow us to explicitly declare data members '
|
||||
'(like\n'
|
||||
'properties) and deny the creation of *__dict__* and '
|
||||
'properties) and deny the creation of "__dict__" and '
|
||||
'*__weakref__*\n'
|
||||
'(unless explicitly declared in *__slots__* or available in a '
|
||||
'parent.)\n'
|
||||
'\n'
|
||||
'The space saved over using *__dict__* can be significant. '
|
||||
'The space saved over using "__dict__" can be significant. '
|
||||
'Attribute\n'
|
||||
'lookup speed can be significantly improved as well.\n'
|
||||
'\n'
|
||||
|
@ -9856,7 +9814,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'*__slots__*\n'
|
||||
' reserves space for the declared variables and prevents '
|
||||
'the\n'
|
||||
' automatic creation of *__dict__* and *__weakref__* for '
|
||||
' automatic creation of "__dict__" and *__weakref__* for '
|
||||
'each\n'
|
||||
' instance.\n'
|
||||
'\n'
|
||||
|
@ -9865,11 +9823,11 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'~~~~~~~~~~~~~~~~~~~~~~~~~~\n'
|
||||
'\n'
|
||||
'* When inheriting from a class without *__slots__*, the '
|
||||
'*__dict__* and\n'
|
||||
'"__dict__" and\n'
|
||||
' *__weakref__* attribute of the instances will always be '
|
||||
'accessible.\n'
|
||||
'\n'
|
||||
'* Without a *__dict__* variable, instances cannot be '
|
||||
'* Without a "__dict__" variable, instances cannot be '
|
||||
'assigned new\n'
|
||||
' variables not listed in the *__slots__* definition. '
|
||||
'Attempts to\n'
|
||||
|
@ -9882,28 +9840,28 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
'* Without a *__weakref__* variable for each instance, '
|
||||
'classes defining\n'
|
||||
' *__slots__* do not support weak references to its '
|
||||
'instances. If weak\n'
|
||||
' reference support is needed, then add "\'__weakref__\'" to '
|
||||
'the\n'
|
||||
' *__slots__* do not support "weak references" to its '
|
||||
'instances. If\n'
|
||||
' weak reference support is needed, then add '
|
||||
'"\'__weakref__\'" to the\n'
|
||||
' sequence of strings in the *__slots__* declaration.\n'
|
||||
'\n'
|
||||
'* *__slots__* are implemented at the class level by '
|
||||
'creating\n'
|
||||
' descriptors (Implementing Descriptors) for each variable '
|
||||
'name. As a\n'
|
||||
' result, class attributes cannot be used to set default '
|
||||
'values for\n'
|
||||
' instance variables defined by *__slots__*; otherwise, the '
|
||||
'class\n'
|
||||
' attribute would overwrite the descriptor assignment.\n'
|
||||
' descriptors for each variable name. As a result, class '
|
||||
'attributes\n'
|
||||
' cannot be used to set default values for instance '
|
||||
'variables defined\n'
|
||||
' by *__slots__*; otherwise, the class attribute would '
|
||||
'overwrite the\n'
|
||||
' descriptor assignment.\n'
|
||||
'\n'
|
||||
'* The action of a *__slots__* declaration is not limited 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'
|
||||
'"__dict__"\n'
|
||||
' and *__weakref__* unless they also define *__slots__* '
|
||||
'(which should\n'
|
||||
' only contain names of any *additional* slots).\n'
|
||||
|
@ -9923,13 +9881,18 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' “variable-length” built-in types such as "int", "bytes" '
|
||||
'and "tuple".\n'
|
||||
'\n'
|
||||
'* Any non-string iterable may be assigned to *__slots__*. '
|
||||
'Mappings may\n'
|
||||
' also be used; however, in the future, special meaning may '
|
||||
'be\n'
|
||||
' assigned to the values corresponding to each key.\n'
|
||||
'* Any non-string *iterable* may be assigned to *__slots__*.\n'
|
||||
'\n'
|
||||
'* *__class__* assignment works only if both classes have the '
|
||||
'* If a "dictionary" is used to assign *__slots__*, the '
|
||||
'dictionary keys\n'
|
||||
' will be used as the slot names. The values of the '
|
||||
'dictionary can be\n'
|
||||
' used to provide per-attribute docstrings that will be '
|
||||
'recognised by\n'
|
||||
' "inspect.getdoc()" and displayed in the output of '
|
||||
'"help()".\n'
|
||||
'\n'
|
||||
'* "__class__" assignment works only if both classes have the '
|
||||
'same\n'
|
||||
' *__slots__*.\n'
|
||||
'\n'
|
||||
|
@ -9941,9 +9904,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'violations\n'
|
||||
' raise "TypeError".\n'
|
||||
'\n'
|
||||
'* If an iterator is used for *__slots__* then a descriptor '
|
||||
'is created\n'
|
||||
' for each of the iterator’s values. However, the '
|
||||
'* If an *iterator* is used for *__slots__* then a '
|
||||
'*descriptor* is\n'
|
||||
' created for each of the iterator’s values. However, the '
|
||||
'*__slots__*\n'
|
||||
' attribute will be an empty iterator.\n'
|
||||
'\n'
|
||||
|
@ -9952,7 +9915,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'==========================\n'
|
||||
'\n'
|
||||
'Whenever a class inherits from another class, '
|
||||
'*__init_subclass__* is\n'
|
||||
'"__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 '
|
||||
|
@ -10152,10 +10115,10 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'come from\n'
|
||||
'the class definition). The "__prepare__" method should be '
|
||||
'implemented\n'
|
||||
'as a "classmethod()". The namespace returned by '
|
||||
'"__prepare__" is\n'
|
||||
'passed in to "__new__", but when the final class object is '
|
||||
'created the\n'
|
||||
'as a "classmethod". The namespace returned by "__prepare__" '
|
||||
'is passed\n'
|
||||
'in to "__new__", but when the final class object is created '
|
||||
'the\n'
|
||||
'namespace is copied into a new "dict".\n'
|
||||
'\n'
|
||||
'If the metaclass has no "__prepare__" attribute, then the '
|
||||
|
@ -10532,60 +10495,60 @@ 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 mappings\n'
|
||||
'(like dictionaries), but can represent other containers as '
|
||||
'well. The\n'
|
||||
'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 '
|
||||
'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" '
|
||||
'objects.\n'
|
||||
'The "collections.abc" module provides a "MutableMapping" '
|
||||
'abstract base\n'
|
||||
'class to help create those methods from a base set of '
|
||||
'"__getitem__()",\n'
|
||||
'"__setitem__()", "__delitem__()", and "keys()". Mutable '
|
||||
'sequences\n'
|
||||
'should provide methods "append()", "count()", "index()", '
|
||||
'"extend()",\n'
|
||||
'"insert()", "pop()", "remove()", "reverse()" and "sort()", '
|
||||
'like Python\n'
|
||||
'standard list objects. Finally, sequence types should '
|
||||
'implement\n'
|
||||
'addition (meaning concatenation) and multiplication '
|
||||
'(meaning\n'
|
||||
'repetition) by defining the methods "__add__()", '
|
||||
'"__radd__()",\n'
|
||||
'"__iadd__()", "__mul__()", "__rmul__()" and "__imul__()" '
|
||||
'described\n'
|
||||
'below; they should not define other numerical operators. It '
|
||||
'is\n'
|
||||
'recommended that both mappings and sequences implement the\n'
|
||||
'"__contains__()" method to allow efficient use of the "in" '
|
||||
'operator;\n'
|
||||
'for mappings, "in" should search the mapping’s keys; for '
|
||||
'sequences, it\n'
|
||||
'should search through the values. It is further recommended '
|
||||
'that both\n'
|
||||
'mappings and sequences implement the "__iter__()" method to '
|
||||
'allow\n'
|
||||
'efficient iteration through the container; for mappings, '
|
||||
'"__iter__()"\n'
|
||||
'should iterate through the object’s keys; for sequences, it '
|
||||
'should\n'
|
||||
'iterate through the values.\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'
|
||||
'"__iter__()" method to allow efficient iteration through '
|
||||
'the\n'
|
||||
'container; for mappings, "__iter__()" should iterate through '
|
||||
'the\n'
|
||||
'object’s keys; for sequences, it should iterate through the '
|
||||
'values.\n'
|
||||
'\n'
|
||||
'object.__len__(self)\n'
|
||||
'\n'
|
||||
|
@ -11493,9 +11456,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
' >>> from keyword import iskeyword\n'
|
||||
'\n'
|
||||
" >>> 'hello'.isidentifier(), iskeyword('hello')\n"
|
||||
' True, False\n'
|
||||
' (True, False)\n'
|
||||
" >>> 'def'.isidentifier(), iskeyword('def')\n"
|
||||
' True, True\n'
|
||||
' (True, True)\n'
|
||||
'\n'
|
||||
'str.islower()\n'
|
||||
'\n'
|
||||
|
@ -11846,7 +11809,7 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
" >>> ' 1 2 3 '.split()\n"
|
||||
" ['1', '2', '3']\n"
|
||||
'\n'
|
||||
'str.splitlines([keepends])\n'
|
||||
'str.splitlines(keepends=False)\n'
|
||||
'\n'
|
||||
' Return a list of the lines in the string, breaking at '
|
||||
'line\n'
|
||||
|
@ -13203,14 +13166,14 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'"async\n'
|
||||
' for" statement to execute the body of the function.\n'
|
||||
'\n'
|
||||
' Calling the asynchronous iterator’s "aiterator.__anext__()"\n'
|
||||
' method will return an *awaitable* which when awaited will\n'
|
||||
' execute until it provides a value using the "yield" '
|
||||
'expression.\n'
|
||||
' When the function executes an empty "return" statement or '
|
||||
'falls\n'
|
||||
' off the end, a "StopAsyncIteration" exception is raised and '
|
||||
' Calling the asynchronous iterator’s "aiterator.__anext__" '
|
||||
'method\n'
|
||||
' will return an *awaitable* which when awaited will execute '
|
||||
'until\n'
|
||||
' it provides a value using the "yield" expression. When the\n'
|
||||
' function executes an empty "return" statement or falls off '
|
||||
'the\n'
|
||||
' end, a "StopAsyncIteration" exception is raised and the\n'
|
||||
' asynchronous iterator will have reached the end of the set '
|
||||
'of\n'
|
||||
' values to be yielded.\n'
|
||||
|
@ -13754,9 +13717,9 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'"dict"\n'
|
||||
'constructor.\n'
|
||||
'\n'
|
||||
'class dict(**kwarg)\n'
|
||||
'class dict(mapping, **kwarg)\n'
|
||||
'class dict(iterable, **kwarg)\n'
|
||||
'class dict(**kwargs)\n'
|
||||
'class dict(mapping, **kwargs)\n'
|
||||
'class dict(iterable, **kwargs)\n'
|
||||
'\n'
|
||||
' Return a new dictionary initialized from an optional '
|
||||
'positional\n'
|
||||
|
@ -14406,6 +14369,14 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'Comparisons in\n'
|
||||
'the language reference.)\n'
|
||||
'\n'
|
||||
'Forward and reversed iterators over mutable sequences access '
|
||||
'values\n'
|
||||
'using an index. That index will continue to march forward (or\n'
|
||||
'backward) even if the underlying sequence is mutated. The '
|
||||
'iterator\n'
|
||||
'terminates only when an "IndexError" or a "StopIteration" is\n'
|
||||
'encountered (or when the index drops below zero).\n'
|
||||
'\n'
|
||||
'Notes:\n'
|
||||
'\n'
|
||||
'1. While the "in" and "not in" operations are used only for '
|
||||
|
@ -14877,7 +14848,8 @@ topics = {'assert': 'The "assert" statement\n'
|
|||
'\n'
|
||||
' The arguments to the range constructor must be integers '
|
||||
'(either\n'
|
||||
' built-in "int" or any object that implements the "__index__"\n'
|
||||
' built-in "int" or any object that implements the '
|
||||
'"__index__()"\n'
|
||||
' special method). If the *step* argument is omitted, it '
|
||||
'defaults to\n'
|
||||
' "1". If the *start* argument is omitted, it defaults to "0". '
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue