summaryrefslogtreecommitdiff
path: root/Lib/pydoc_data
diff options
context:
space:
mode:
authorŁukasz Langa <lukasz@langa.pl>2019-02-03 14:04:12 +0100
committerŁukasz Langa <lukasz@langa.pl>2019-02-03 14:04:12 +0100
commitaab0e57045f6badaa1404409626545785ef02d62 (patch)
treedf9ac88b8d9f4efc2d3c586f688d7a70bbf00304 /Lib/pydoc_data
parent8efa3b69f669fcca8ebe0d046ae078e64d073bd2 (diff)
downloadcpython-git-aab0e57045f6badaa1404409626545785ef02d62.tar.gz
[pydoc] Regenerate topics for v3.8.0a1
Diffstat (limited to 'Lib/pydoc_data')
-rw-r--r--Lib/pydoc_data/topics.py1955
1 files changed, 1128 insertions, 827 deletions
diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py
index a979931e26..4310ca5ba6 100644
--- a/Lib/pydoc_data/topics.py
+++ b/Lib/pydoc_data/topics.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-# Autogenerated by Sphinx on Tue Jan 30 18:36:07 2018
+# Autogenerated by Sphinx on Sun Feb 3 14:00:19 2019
topics = {'assert': 'The "assert" statement\n'
'**********************\n'
'\n'
@@ -26,7 +26,8 @@ topics = {'assert': 'The "assert" statement\n'
'implementation, the built-in variable "__debug__" is "True" under\n'
'normal circumstances, "False" when optimization is requested '
'(command\n'
- 'line option -O). The current code generator emits no code for an\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 '
@@ -87,26 +88,19 @@ topics = {'assert': 'The "assert" statement\n'
'parentheses or square brackets, is recursively defined as '
'follows.\n'
'\n'
- '* If the target list is empty: The object must also be an '
- 'empty\n'
- ' iterable.\n'
- '\n'
- '* If the target list is a single target in parentheses: The '
- 'object\n'
- ' is assigned to that target.\n'
+ '* If the target list is a single target with no trailing '
+ 'comma,\n'
+ ' optionally in parentheses, the object is assigned to that '
+ 'target.\n'
'\n'
- '* If the target list is a comma-separated list of targets, or '
- 'a\n'
- ' single target in square brackets: The object must be an '
- 'iterable\n'
- ' with the same number of items as there are targets in the '
- 'target\n'
- ' list, and the items are assigned, from left to right, to '
- 'the\n'
- ' corresponding targets.\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'
'\n'
' * If the target list contains one target prefixed with an\n'
- ' asterisk, called a "starred" target: The object must be '
+ ' asterisk, called a “starred” target: The object must be '
'an\n'
' iterable with at least as many items as there are targets '
'in the\n'
@@ -203,10 +197,10 @@ topics = {'assert': 'The "assert" statement\n'
' If the primary is a mutable sequence object (such as a '
'list), the\n'
' subscript must yield an integer. If it is negative, the '
- "sequence's\n"
+ 'sequence’s\n'
' length is added to it. The resulting value must be a '
'nonnegative\n'
- " integer less than the sequence's length, and the sequence is "
+ ' integer less than the sequence’s length, and the sequence is '
'asked\n'
' to assign the assigned object to its item with that index. '
'If the\n'
@@ -216,7 +210,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' If the primary is a mapping object (such as a dictionary), '
'the\n'
- " subscript must have a type compatible with the mapping's key "
+ ' subscript must have a type compatible with the mapping’s key '
'type,\n'
' and the mapping is then asked to create a key/datum pair '
'which maps\n'
@@ -239,12 +233,12 @@ topics = {'assert': 'The "assert" statement\n'
'expressions are\n'
' evaluated, insofar they are present; defaults are zero and '
'the\n'
- " sequence's length. The bounds should evaluate to integers. "
+ ' sequence’s length. The bounds should evaluate to integers. '
'If\n'
- " either bound is negative, the sequence's length is added to "
+ ' either bound is negative, the sequence’s length is added to '
'it. The\n'
' resulting bounds are clipped to lie between zero and the '
- "sequence's\n"
+ 'sequence’s\n'
' length, inclusive. Finally, the sequence object is asked to '
'replace\n'
' the slice with the items of the assigned sequence. The '
@@ -265,7 +259,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'Although the definition of assignment implies that overlaps '
'between\n'
- "the left-hand side and the right-hand side are 'simultaneous' "
+ 'the left-hand side and the right-hand side are ‘simultaneous’ '
'(for\n'
'example "a, b = b, a" swaps two variables), overlaps *within* '
'the\n'
@@ -357,9 +351,9 @@ topics = {'assert': 'The "assert" statement\n'
'Annotated assignment statements\n'
'===============================\n'
'\n'
- 'Annotation assignment is the combination, in a single '
- 'statement, of a\n'
- 'variable or attribute annotation and an optional assignment '
+ '*Annotation* assignment is the combination, in a single '
+ 'statement, of\n'
+ 'a variable or attribute annotation and an optional assignment\n'
'statement:\n'
'\n'
' annotated_assignment_stmt ::= augtarget ":" expression ["=" '
@@ -400,9 +394,153 @@ topics = {'assert': 'The "assert" statement\n'
'the last\n'
'"__setitem__()" or "__setattr__()" call.\n'
'\n'
- 'See also: **PEP 526** - Variable and attribute annotation '
- 'syntax\n'
- ' **PEP 484** - Type hints\n',
+ 'See also:\n'
+ '\n'
+ ' **PEP 526** - Syntax for Variable Annotations\n'
+ ' The proposal that added syntax for annotating the types '
+ 'of\n'
+ ' variables (including class variables and instance '
+ 'variables),\n'
+ ' instead of expressing them through comments.\n'
+ '\n'
+ ' **PEP 484** - Type hints\n'
+ ' The proposal that added the "typing" module to provide a '
+ 'standard\n'
+ ' syntax for type annotations that can be used in static '
+ 'analysis\n'
+ ' tools and IDEs.\n',
+ 'async': 'Coroutines\n'
+ '**********\n'
+ '\n'
+ 'New in version 3.5.\n'
+ '\n'
+ '\n'
+ 'Coroutine function definition\n'
+ '=============================\n'
+ '\n'
+ ' async_funcdef ::= [decorators] "async" "def" funcname "(" '
+ '[parameter_list] ")"\n'
+ ' ["->" expression] ":" suite\n'
+ '\n'
+ 'Execution of Python coroutines can be suspended and resumed at '
+ 'many\n'
+ 'points (see *coroutine*). Inside the body of a coroutine '
+ 'function,\n'
+ '"await" and "async" identifiers become reserved keywords; "await"\n'
+ 'expressions, "async for" and "async with" can only be used in\n'
+ 'coroutine function bodies.\n'
+ '\n'
+ 'Functions defined with "async def" syntax are always coroutine\n'
+ 'functions, even if they do not contain "await" or "async" '
+ 'keywords.\n'
+ '\n'
+ 'It is a "SyntaxError" to use a "yield from" expression inside the '
+ 'body\n'
+ 'of a coroutine function.\n'
+ '\n'
+ 'An example of a coroutine function:\n'
+ '\n'
+ ' async def func(param1, param2):\n'
+ ' do_stuff()\n'
+ ' await some_coroutine()\n'
+ '\n'
+ '\n'
+ 'The "async for" statement\n'
+ '=========================\n'
+ '\n'
+ ' async_for_stmt ::= "async" for_stmt\n'
+ '\n'
+ 'An *asynchronous iterable* is able to call asynchronous code in '
+ 'its\n'
+ '*iter* implementation, and *asynchronous iterator* can call\n'
+ 'asynchronous code in its *next* method.\n'
+ '\n'
+ 'The "async for" statement allows convenient iteration over\n'
+ 'asynchronous iterators.\n'
+ '\n'
+ 'The following code:\n'
+ '\n'
+ ' async for TARGET in ITER:\n'
+ ' BLOCK\n'
+ ' else:\n'
+ ' BLOCK2\n'
+ '\n'
+ 'Is semantically equivalent to:\n'
+ '\n'
+ ' iter = (ITER)\n'
+ ' iter = type(iter).__aiter__(iter)\n'
+ ' running = True\n'
+ ' while running:\n'
+ ' try:\n'
+ ' TARGET = await type(iter).__anext__(iter)\n'
+ ' except StopAsyncIteration:\n'
+ ' running = False\n'
+ ' else:\n'
+ ' BLOCK\n'
+ ' else:\n'
+ ' BLOCK2\n'
+ '\n'
+ 'See also "__aiter__()" and "__anext__()" for details.\n'
+ '\n'
+ 'It is a "SyntaxError" to use an "async for" statement outside the '
+ 'body\n'
+ 'of a coroutine function.\n'
+ '\n'
+ '\n'
+ 'The "async with" statement\n'
+ '==========================\n'
+ '\n'
+ ' async_with_stmt ::= "async" with_stmt\n'
+ '\n'
+ 'An *asynchronous context manager* is a *context manager* that is '
+ 'able\n'
+ 'to suspend execution in its *enter* and *exit* methods.\n'
+ '\n'
+ 'The following code:\n'
+ '\n'
+ ' async with EXPR as VAR:\n'
+ ' BLOCK\n'
+ '\n'
+ 'Is semantically equivalent to:\n'
+ '\n'
+ ' mgr = (EXPR)\n'
+ ' aexit = type(mgr).__aexit__\n'
+ ' aenter = type(mgr).__aenter__(mgr)\n'
+ '\n'
+ ' VAR = await aenter\n'
+ ' try:\n'
+ ' BLOCK\n'
+ ' except:\n'
+ ' if not await aexit(mgr, *sys.exc_info()):\n'
+ ' raise\n'
+ ' else:\n'
+ ' await aexit(mgr, None, None, None)\n'
+ '\n'
+ 'See also "__aenter__()" and "__aexit__()" for details.\n'
+ '\n'
+ 'It is a "SyntaxError" to use an "async with" statement outside the\n'
+ 'body of a coroutine function.\n'
+ '\n'
+ 'See also:\n'
+ '\n'
+ ' **PEP 492** - Coroutines with async and await syntax\n'
+ ' The proposal that made coroutines a proper standalone concept '
+ 'in\n'
+ ' Python, and added supporting syntax.\n'
+ '\n'
+ '-[ Footnotes ]-\n'
+ '\n'
+ '[1] The exception is propagated to the invocation stack unless\n'
+ ' there is a "finally" clause which happens to raise another\n'
+ ' exception. That new exception causes the old one to be lost.\n'
+ '\n'
+ '[2] A string literal appearing as the first statement in the\n'
+ ' function body is transformed into the function’s "__doc__"\n'
+ ' attribute and therefore the function’s *docstring*.\n'
+ '\n'
+ '[3] A string literal appearing as the first statement in the class\n'
+ ' body is transformed into the namespace’s "__doc__" item and\n'
+ ' therefore the class’s *docstring*.\n',
'atom-identifiers': 'Identifiers (Names)\n'
'*******************\n'
'\n'
@@ -464,7 +602,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'All literals correspond to immutable data types, and hence '
'the\n'
- "object's identity is less important than its value. "
+ 'object’s identity is less important than its value. '
'Multiple\n'
'evaluations of literals with the same value (either the '
'same\n'
@@ -483,15 +621,19 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'object.__getattr__(self, name)\n'
'\n'
- ' Called when an attribute lookup has not found the '
- 'attribute in the\n'
- ' usual places (i.e. it is not an instance attribute '
- 'nor is it found\n'
- ' in the class tree for "self"). "name" is the '
- 'attribute name. This\n'
- ' method should return the (computed) attribute value '
- 'or raise an\n'
- ' "AttributeError" exception.\n'
+ ' Called when the default attribute access fails with '
+ 'an\n'
+ ' "AttributeError" (either "__getattribute__()" raises '
+ 'an\n'
+ ' "AttributeError" because *name* is not an instance '
+ 'attribute or an\n'
+ ' attribute in the class tree for "self"; or '
+ '"__get__()" of a *name*\n'
+ ' property raises "AttributeError"). This method '
+ 'should either\n'
+ ' return the (computed) attribute value or raise an '
+ '"AttributeError"\n'
+ ' exception.\n'
'\n'
' Note that if the attribute is found through the '
'normal mechanism,\n'
@@ -615,17 +757,17 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' def __setattr__(self, attr, value):\n'
" print(f'Setting {attr}...')\n"
- ' setattr(self, attr, value)\n'
+ ' super().__setattr__(attr, value)\n'
'\n'
' sys.modules[__name__].__class__ = VerboseModule\n'
'\n'
'Note: Defining module "__getattr__" and setting module '
'"__class__"\n'
' only affect lookups made using the attribute access '
- 'syntax --\n'
+ 'syntax –\n'
' directly accessing the module globals (whether by code '
'within the\n'
- " module, or via a reference to the module's globals "
+ ' module, or via a reference to the module’s globals '
'dictionary) is\n'
' unaffected.\n'
'\n'
@@ -650,13 +792,12 @@ topics = {'assert': 'The "assert" statement\n'
'containing the method (a so-called *descriptor* class) '
'appears in an\n'
'*owner* class (the descriptor must be in either the '
- "owner's class\n"
+ 'owner’s class\n'
'dictionary or in the class dictionary for one of its '
'parents). In the\n'
- 'examples below, "the attribute" refers to the attribute '
+ '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__".\n'
'\n'
'object.__get__(self, instance, owner)\n'
'\n'
@@ -713,8 +854,8 @@ topics = {'assert': 'The "assert" statement\n'
'====================\n'
'\n'
'In general, a descriptor is an object attribute with '
- '"binding\n'
- 'behavior", one whose attribute access has been '
+ '“binding\n'
+ 'behavior”, one whose attribute access has been '
'overridden by methods\n'
'in the descriptor protocol: "__get__()", "__set__()", '
'and\n'
@@ -724,7 +865,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'The default behavior for attribute access is to get, '
'set, or delete\n'
- "the attribute from an object's dictionary. For instance, "
+ 'the attribute from an object’s dictionary. For instance, '
'"a.x" has a\n'
'lookup chain starting with "a.__dict__[\'x\']", then\n'
'"type(a).__dict__[\'x\']", and continuing through the '
@@ -779,7 +920,7 @@ topics = {'assert': 'The "assert" statement\n'
'does not define "__get__()", then accessing the '
'attribute will return\n'
'the descriptor object itself unless there is a value in '
- "the object's\n"
+ 'the object’s\n'
'instance dictionary. If the descriptor defines '
'"__set__()" and/or\n'
'"__delete__()", it is a data descriptor; if it defines '
@@ -900,7 +1041,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'* Nonempty *__slots__* does not work for classes derived '
'from\n'
- ' "variable-length" built-in types such as "int", '
+ ' “variable-length” built-in types such as "int", '
'"bytes" and "tuple".\n'
'\n'
'* Any non-string iterable may be assigned to '
@@ -1027,7 +1168,7 @@ topics = {'assert': 'The "assert" statement\n'
'operators:\n'
'\n'
' m_expr ::= u_expr | m_expr "*" u_expr | m_expr "@" m_expr |\n'
- ' m_expr "//" u_expr| m_expr "/" u_expr |\n'
+ ' m_expr "//" u_expr | m_expr "/" u_expr |\n'
' m_expr "%" u_expr\n'
' a_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr\n'
'\n'
@@ -1052,7 +1193,7 @@ topics = {'assert': 'The "assert" statement\n'
'while\n'
'floor division of integers results in an integer; the result is '
'that\n'
- "of mathematical division with the 'floor' function applied to the\n"
+ 'of mathematical division with the ‘floor’ function applied to the\n'
'result. Division by zero raises the "ZeroDivisionError" '
'exception.\n'
'\n'
@@ -1128,10 +1269,10 @@ topics = {'assert': 'The "assert" statement\n'
'************\n'
'\n'
'Code objects are used by the implementation to '
- 'represent "pseudo-\n'
- 'compiled" executable Python code such as a function '
+ 'represent “pseudo-\n'
+ 'compiled” executable Python code such as a function '
'body. They differ\n'
- "from function objects because they don't contain a "
+ 'from function objects because they don’t contain a '
'reference to their\n'
'global execution environment. Code objects are '
'returned by the built-\n'
@@ -1162,7 +1303,7 @@ topics = {'assert': 'The "assert" statement\n'
'bltin-null-object': 'The Null Object\n'
'***************\n'
'\n'
- "This object is returned by functions that don't "
+ 'This object is returned by functions that don’t '
'explicitly return a\n'
'value. It supports no special operations. There is '
'exactly one null\n'
@@ -1175,7 +1316,7 @@ topics = {'assert': 'The "assert" statement\n'
'************\n'
'\n'
'Type objects represent the various object types. An '
- "object's type is\n"
+ 'object’s type is\n'
'accessed by the built-in function "type()". There are '
'no special\n'
'operations on types. The standard module "types" '
@@ -1218,7 +1359,7 @@ topics = {'assert': 'The "assert" statement\n'
'is\n'
'returned.\n'
'\n'
- '(Note that neither "and" nor "or" restrict the value and type '
+ 'Note that neither "and" nor "or" restrict the value and type '
'they\n'
'return to "False" and "True", but rather return the last '
'evaluated\n'
@@ -1258,7 +1399,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'object.__call__(self[, args...])\n'
'\n'
- ' Called when the instance is "called" as a function; if '
+ ' Called when the instance is “called” as a function; if '
'this method\n'
' is defined, "x(arg1, arg2, ...)" is a shorthand for\n'
' "x.__call__(arg1, arg2, ...)".\n',
@@ -1318,7 +1459,7 @@ topics = {'assert': 'The "assert" statement\n'
'values are calculated, once, when the function is defined; thus, a\n'
'mutable object such as a list or dictionary used as default value '
'will\n'
- "be shared by all calls that don't specify an argument value for "
+ 'be shared by all calls that don’t specify an argument value for '
'the\n'
'corresponding slot; this should usually be avoided.) If there are '
'any\n'
@@ -1331,7 +1472,7 @@ topics = {'assert': 'The "assert" statement\n'
'**CPython implementation detail:** An implementation may provide\n'
'built-in functions whose positional parameters do not have names, '
'even\n'
- "if they are 'named' for the purpose of documentation, and which\n"
+ 'if they are ‘named’ for the purpose of documentation, and which\n'
'therefore cannot be supplied by keyword. In CPython, this is the '
'case\n'
'for functions implemented in C that use "PyArg_ParseTuple()" to '
@@ -1363,16 +1504,17 @@ topics = {'assert': 'The "assert" statement\n'
'must evaluate to an *iterable*. Elements from these iterables are\n'
'treated as if they were additional positional arguments. For the '
'call\n'
- '"f(x1, x2, *y, x3, x4)", if *y* evaluates to a sequence *y1*, ...,\n'
- '*yM*, this is equivalent to a call with M+4 positional arguments '
- '*x1*,\n'
- '*x2*, *y1*, ..., *yM*, *x3*, *x4*.\n'
+ '"f(x1, x2, *y, x3, x4)", if *y* evaluates to a sequence *y1*, …, '
+ '*yM*,\n'
+ 'this is equivalent to a call with M+4 positional arguments *x1*, '
+ '*x2*,\n'
+ '*y1*, …, *yM*, *x3*, *x4*.\n'
'\n'
'A consequence of this is that although the "*expression" syntax '
'may\n'
'appear *after* explicit keyword arguments, it is processed '
'*before*\n'
- 'the keyword arguments (and any "**expression" arguments -- see '
+ 'the keyword arguments (and any "**expression" arguments – see '
'below).\n'
'So:\n'
'\n'
@@ -1419,7 +1561,7 @@ topics = {'assert': 'The "assert" statement\n'
'exception. How this value is computed depends on the type of the\n'
'callable object.\n'
'\n'
- 'If it is---\n'
+ 'If it is—\n'
'\n'
'a user-defined function:\n'
' The code block for the function is executed, passing it the\n'
@@ -1478,12 +1620,12 @@ topics = {'assert': 'The "assert" statement\n'
' class Foo(object):\n'
' pass\n'
'\n'
- "The class's suite is then executed in a new execution frame (see\n"
+ 'The class’s suite is then executed in a new execution frame (see\n'
'Naming and binding), using a newly created local namespace and the\n'
'original global namespace. (Usually, the suite contains mostly\n'
- "function definitions.) When the class's suite finishes execution, "
+ 'function definitions.) When the class’s suite finishes execution, '
'its\n'
- 'execution frame is discarded but its local namespace is saved. [4] '
+ 'execution frame is discarded but its local namespace is saved. [3] '
'A\n'
'class object is then created using the inheritance list for the '
'base\n'
@@ -1493,7 +1635,7 @@ topics = {'assert': 'The "assert" statement\n'
'namespace.\n'
'\n'
'The order in which attributes are defined in the class body is\n'
- 'preserved in the new class\'s "__dict__". Note that this is '
+ 'preserved in the new class’s "__dict__". Note that this is '
'reliable\n'
'only right after the class is created and only for classes that '
'were\n'
@@ -1517,13 +1659,13 @@ topics = {'assert': 'The "assert" statement\n'
'for\n'
'function decorators. The result is then bound to the class name.\n'
'\n'
- "**Programmer's note:** Variables defined in the class definition "
+ '**Programmer’s note:** Variables defined in the class definition '
'are\n'
'class attributes; they are shared by instances. Instance '
'attributes\n'
'can be set in a method with "self.name = value". Both class and\n'
'instance attributes are accessible through the notation '
- '""self.name"",\n'
+ '“"self.name"”,\n'
'and an instance attribute hides a class attribute with the same '
'name\n'
'when accessed in this way. Class attributes can be used as '
@@ -1533,8 +1675,18 @@ topics = {'assert': 'The "assert" statement\n'
'unexpected results. Descriptors can be used to create instance\n'
'variables with different implementation details.\n'
'\n'
- 'See also: **PEP 3115** - Metaclasses in Python 3 **PEP 3129** -\n'
- ' Class Decorators\n',
+ 'See also:\n'
+ '\n'
+ ' **PEP 3115** - Metaclasses in Python 3000\n'
+ ' The proposal that changed the declaration of metaclasses to '
+ 'the\n'
+ ' current syntax, and the semantics for how classes with\n'
+ ' metaclasses are constructed.\n'
+ '\n'
+ ' **PEP 3129** - Class Decorators\n'
+ ' The proposal that added class decorators. Function and '
+ 'method\n'
+ ' decorators were introduced in **PEP 318**.\n',
'comparisons': 'Comparisons\n'
'***********\n'
'\n'
@@ -1546,7 +1698,7 @@ topics = {'assert': 'The "assert" statement\n'
'the\n'
'interpretation that is conventional in mathematics:\n'
'\n'
- ' comparison ::= or_expr ( comp_operator or_expr )*\n'
+ ' comparison ::= or_expr (comp_operator or_expr)*\n'
' comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n'
' | "is" ["not"] | ["not"] "in"\n'
'\n'
@@ -1560,15 +1712,15 @@ topics = {'assert': 'The "assert" statement\n'
'y" is\n'
'found to be false).\n'
'\n'
- 'Formally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and '
+ 'Formally, if *a*, *b*, *c*, …, *y*, *z* are expressions and '
'*op1*,\n'
- '*op2*, ..., *opN* are comparison operators, then "a op1 b op2 '
- 'c ... y\n'
+ '*op2*, …, *opN* are comparison operators, then "a op1 b op2 c '
+ '... y\n'
'opN z" is equivalent to "a op1 b and b op2 c and ... y opN '
'z", except\n'
'that each expression is evaluated at most once.\n'
'\n'
- 'Note that "a op1 b op2 c" doesn\'t imply any kind of '
+ 'Note that "a op1 b op2 c" doesn’t imply any kind of '
'comparison between\n'
'*a* and *c*, so that, e.g., "x < y > z" is perfectly legal '
'(though\n'
@@ -1589,7 +1741,7 @@ topics = {'assert': 'The "assert" statement\n'
'rather\n'
'abstract notion in Python: For example, there is no canonical '
'access\n'
- "method for an object's value. Also, there is no requirement "
+ 'method for an object’s value. Also, there is no requirement '
'that the\n'
'value of an object should be constructed in a particular way, '
'e.g.\n'
@@ -1643,7 +1795,7 @@ topics = {'assert': 'The "assert" statement\n'
'most\n'
'important built-in types.\n'
'\n'
- '* Numbers of built-in numeric types (Numeric Types --- int, '
+ '* Numbers of built-in numeric types (Numeric Types — int, '
'float,\n'
' complex) and of the standard library types '
'"fractions.Fraction" and\n'
@@ -1657,16 +1809,15 @@ topics = {'assert': 'The "assert" statement\n'
'precision.\n'
'\n'
' The not-a-number values "float(\'NaN\')" and '
- '"Decimal(\'NaN\')" are\n'
- ' special. They are identical to themselves ("x is x" is '
- 'true) but\n'
- ' are not equal to themselves ("x == x" is false). '
- 'Additionally,\n'
- ' comparing any number to a not-a-number value will return '
- '"False".\n'
- ' For example, both "3 < float(\'NaN\')" and "float(\'NaN\') '
- '< 3" will\n'
- ' return "False".\n'
+ '"decimal.Decimal(\'NaN\')"\n'
+ ' are special. Any ordered comparison of a number to a '
+ 'not-a-number\n'
+ ' value is false. A counter-intuitive implication is that '
+ 'not-a-number\n'
+ ' values are not equal to themselves. For example, if "x =\n'
+ ' float(\'NaN\')", "3 < x", "x < 3", "x == x", "x != x" are '
+ 'all false.\n'
+ ' This behavior is compliant with IEEE 754.\n'
'\n'
'* Binary sequences (instances of "bytes" or "bytearray") can '
'be\n'
@@ -1930,9 +2081,9 @@ topics = {'assert': 'The "assert" statement\n'
'compound\n'
'statements.\n'
'\n'
- "A compound statement consists of one or more 'clauses.' A "
+ 'A compound statement consists of one or more ‘clauses.’ A '
'clause\n'
- "consists of a header and a 'suite.' The clause headers of a\n"
+ 'consists of a header and a ‘suite.’ The clause headers of a\n'
'particular compound statement are all at the same indentation '
'level.\n'
'Each clause header begins with a uniquely identifying keyword '
@@ -1940,12 +2091,12 @@ topics = {'assert': 'The "assert" statement\n'
'with a colon. A suite is a group of statements controlled by a\n'
'clause. A suite can be one or more semicolon-separated simple\n'
'statements on the same line as the header, following the '
- "header's\n"
+ 'header’s\n'
'colon, or it can be one or more indented statements on '
'subsequent\n'
'lines. Only the latter form of a suite can contain nested '
'compound\n'
- "statements; the following is illegal, mostly because it wouldn't "
+ 'statements; the following is illegal, mostly because it wouldn’t '
'be\n'
'clear to which "if" clause a following "else" clause would '
'belong:\n'
@@ -1982,7 +2133,7 @@ topics = {'assert': 'The "assert" statement\n'
'"DEDENT". Also note that optional continuation clauses always '
'begin\n'
'with a keyword that cannot start a statement, thus there are no\n'
- 'ambiguities (the \'dangling "else"\' problem is solved in Python '
+ 'ambiguities (the ‘dangling "else"’ problem is solved in Python '
'by\n'
'requiring nested "if" statements to be indented).\n'
'\n'
@@ -1997,7 +2148,7 @@ topics = {'assert': 'The "assert" statement\n'
'The "if" statement is used for conditional execution:\n'
'\n'
' if_stmt ::= "if" expression ":" suite\n'
- ' ( "elif" expression ":" suite )*\n'
+ ' ("elif" expression ":" suite)*\n'
' ["else" ":" suite]\n'
'\n'
'It selects exactly one of the suites by evaluating the '
@@ -2033,7 +2184,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'A "break" statement executed in the first suite terminates the '
'loop\n'
- 'without executing the "else" clause\'s suite. A "continue" '
+ 'without executing the "else" clause’s suite. A "continue" '
'statement\n'
'executed in the first suite skips the rest of the suite and goes '
'back\n'
@@ -2072,7 +2223,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'A "break" statement executed in the first suite terminates the '
'loop\n'
- 'without executing the "else" clause\'s suite. A "continue" '
+ 'without executing the "else" clause’s suite. A "continue" '
'statement\n'
'executed in the first suite skips the rest of the suite and '
'continues\n'
@@ -2080,7 +2231,7 @@ topics = {'assert': 'The "assert" statement\n'
'next\n'
'item.\n'
'\n'
- 'The for-loop makes assignments to the variables(s) in the target '
+ 'The for-loop makes assignments to the variables in the target '
'list.\n'
'This overwrites all previous assignments to those variables '
'including\n'
@@ -2099,14 +2250,14 @@ topics = {'assert': 'The "assert" statement\n'
'to at\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 "
+ '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: There is a subtlety when the sequence is being modified by '
'the\n'
- ' loop (this can only occur for mutable sequences, i.e. lists). '
+ ' loop (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'
@@ -2161,7 +2312,7 @@ topics = {'assert': 'The "assert" statement\n'
'expression\n'
'is evaluated, and the clause matches the exception if the '
'resulting\n'
- 'object is "compatible" with the exception. An object is '
+ 'object is “compatible” with the exception. An object is '
'compatible\n'
'with an exception if it is the class or a base class of the '
'exception\n'
@@ -2188,7 +2339,7 @@ topics = {'assert': 'The "assert" statement\n'
'assigned to\n'
'the target specified after the "as" keyword in that except '
'clause, if\n'
- "present, and the except clause's suite is executed. All except\n"
+ 'present, and the except clause’s suite is executed. All except\n'
'clauses must have an executable block. When the end of this '
'block is\n'
'reached, execution continues normally after the entire try '
@@ -2224,7 +2375,7 @@ topics = {'assert': 'The "assert" statement\n'
'alive\n'
'until the next garbage collection occurs.\n'
'\n'
- "Before an except clause's suite is executed, details about the\n"
+ 'Before an except clause’s suite is executed, details about the\n'
'exception are stored in the "sys" module and can be accessed '
'via\n'
'"sys.exc_info()". "sys.exc_info()" returns a 3-tuple consisting '
@@ -2239,14 +2390,16 @@ topics = {'assert': 'The "assert" statement\n'
'returning\n'
'from a function that handled an exception.\n'
'\n'
- 'The optional "else" clause is executed if and when control flows '
- 'off\n'
- 'the end of the "try" clause. [2] Exceptions in the "else" clause '
+ 'The optional "else" clause is executed if the control flow '
+ 'leaves the\n'
+ '"try" suite, no exception was raised, and no "return", '
+ '"continue", or\n'
+ '"break" statement was executed. Exceptions in the "else" clause '
'are\n'
'not handled by the preceding "except" clauses.\n'
'\n'
- 'If "finally" is present, it specifies a \'cleanup\' handler. '
- 'The "try"\n'
+ 'If "finally" is present, it specifies a ‘cleanup’ handler. The '
+ '"try"\n'
'clause is executed, including any "except" and "else" clauses. '
'If an\n'
'exception occurs in any of the clauses and is not handled, the\n'
@@ -2258,9 +2411,9 @@ topics = {'assert': 'The "assert" statement\n'
'saved\n'
'exception is set as the context of the new exception. If the '
'"finally"\n'
- 'clause executes a "return" or "break" statement, the saved '
- 'exception\n'
- 'is discarded:\n'
+ 'clause executes a "return", "break" or "continue" statement, the '
+ 'saved\n'
+ 'exception is discarded:\n'
'\n'
' >>> def f():\n'
' ... try:\n'
@@ -2277,13 +2430,9 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'When a "return", "break" or "continue" statement is executed in '
'the\n'
- '"try" suite of a "try"..."finally" statement, the "finally" '
- 'clause is\n'
- 'also executed \'on the way out.\' A "continue" statement is '
- 'illegal in\n'
- 'the "finally" clause. (The reason is a problem with the current\n'
- 'implementation --- this restriction may be lifted in the '
- 'future).\n'
+ '"try" suite of a "try"…"finally" statement, the "finally" clause '
+ 'is\n'
+ 'also executed ‘on the way out.’\n'
'\n'
'The return value of a function is determined by the last '
'"return"\n'
@@ -2307,6 +2456,11 @@ topics = {'assert': 'The "assert" statement\n'
'generate\n'
'exceptions may be found in section The raise statement.\n'
'\n'
+ 'Changed in version 3.8: Prior to Python 3.8, a "continue" '
+ 'statement\n'
+ 'was illegal in the "finally" clause due to a problem with the\n'
+ 'implementation.\n'
+ '\n'
'\n'
'The "with" statement\n'
'====================\n'
@@ -2315,14 +2469,14 @@ topics = {'assert': 'The "assert" statement\n'
'with\n'
'methods defined by a context manager (see section With '
'Statement\n'
- 'Context Managers). This allows common '
- '"try"..."except"..."finally"\n'
- 'usage patterns to be encapsulated for convenient reuse.\n'
+ 'Context Managers). This allows common "try"…"except"…"finally" '
+ 'usage\n'
+ 'patterns to be encapsulated for convenient reuse.\n'
'\n'
' with_stmt ::= "with" with_item ("," with_item)* ":" suite\n'
' with_item ::= expression ["as" target]\n'
'\n'
- 'The execution of the "with" statement with one "item" proceeds '
+ 'The execution of the "with" statement with one “item” proceeds '
'as\n'
'follows:\n'
'\n'
@@ -2330,9 +2484,9 @@ topics = {'assert': 'The "assert" statement\n'
'"with_item")\n'
' is evaluated to obtain a context manager.\n'
'\n'
- '2. The context manager\'s "__exit__()" is loaded for later use.\n'
+ '2. The context manager’s "__exit__()" is loaded for later use.\n'
'\n'
- '3. The context manager\'s "__enter__()" method is invoked.\n'
+ '3. The context manager’s "__enter__()" method is invoked.\n'
'\n'
'4. If a target was included in the "with" statement, the return\n'
' value from "__enter__()" is assigned to it.\n'
@@ -2349,8 +2503,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'5. The suite is executed.\n'
'\n'
- '6. The context manager\'s "__exit__()" method is invoked. If '
- 'an\n'
+ '6. The context manager’s "__exit__()" method is invoked. If an\n'
' exception caused the suite to be exited, its type, value, '
'and\n'
' traceback are passed as arguments to "__exit__()". Otherwise, '
@@ -2390,7 +2543,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'See also:\n'
'\n'
- ' **PEP 343** - The "with" statement\n'
+ ' **PEP 343** - The “with” statement\n'
' The specification, background, and examples for the Python '
'"with"\n'
' statement.\n'
@@ -2404,7 +2557,8 @@ topics = {'assert': 'The "assert" statement\n'
'section The standard type hierarchy):\n'
'\n'
' funcdef ::= [decorators] "def" funcname "(" '
- '[parameter_list] ")" ["->" expression] ":" suite\n'
+ '[parameter_list] ")"\n'
+ ' ["->" expression] ":" suite\n'
' decorators ::= decorator+\n'
' decorator ::= "@" dotted_name ["(" '
'[argument_list [","]] ")"] NEWLINE\n'
@@ -2430,7 +2584,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'The function definition does not execute the function body; this '
'gets\n'
- 'executed only when the function is called. [3]\n'
+ 'executed only when the function is called. [2]\n'
'\n'
'A function definition may be wrapped by one or more *decorator*\n'
'expressions. Decorator expressions are evaluated when the '
@@ -2459,25 +2613,24 @@ topics = {'assert': 'The "assert" statement\n'
'"func".\n'
'\n'
'When one or more *parameters* have the form *parameter* "="\n'
- '*expression*, the function is said to have "default parameter '
- 'values."\n'
+ '*expression*, the function is said to have “default parameter '
+ 'values.”\n'
'For a parameter with a default value, the corresponding '
'*argument* may\n'
- "be omitted from a call, in which case the parameter's default "
+ 'be omitted from a call, in which case the parameter’s default '
'value is\n'
'substituted. If a parameter has a default value, all following\n'
- 'parameters up until the ""*"" must also have a default value --- '
- 'this\n'
- 'is a syntactic restriction that is not expressed by the '
- 'grammar.\n'
+ 'parameters up until the “"*"” must also have a default value — '
+ 'this is\n'
+ 'a syntactic restriction that is not expressed by the grammar.\n'
'\n'
'**Default parameter values are evaluated from left to right when '
'the\n'
'function definition is executed.** This means that the '
'expression is\n'
'evaluated once, when the function is defined, and that the same '
- '"pre-\n'
- 'computed" value is used for each call. This is especially '
+ '“pre-\n'
+ 'computed” value is used for each call. This is especially '
'important\n'
'to understand when a default parameter is a mutable object, such '
'as a\n'
@@ -2503,44 +2656,44 @@ topics = {'assert': 'The "assert" statement\n'
'mentioned in\n'
'the parameter list, either from position arguments, from '
'keyword\n'
- 'arguments, or from default values. If the form ""*identifier"" '
+ 'arguments, or from default values. If the form “"*identifier"” '
'is\n'
'present, it is initialized to a tuple receiving any excess '
'positional\n'
'parameters, defaulting to the empty tuple. If the form\n'
- '""**identifier"" is present, it is initialized to a new ordered\n'
+ '“"**identifier"” is present, it is initialized to a new ordered\n'
'mapping receiving any excess keyword arguments, defaulting to a '
'new\n'
- 'empty mapping of the same type. Parameters after ""*"" or\n'
- '""*identifier"" are keyword-only parameters and may only be '
+ 'empty mapping of the same type. Parameters after “"*"” or\n'
+ '“"*identifier"” are keyword-only parameters and may only be '
'passed\n'
'used keyword arguments.\n'
'\n'
- 'Parameters may have annotations of the form "": expression"" '
- 'following\n'
- 'the parameter name. Any parameter may have an annotation even '
- 'those\n'
- 'of the form "*identifier" or "**identifier". Functions may '
- 'have\n'
- '"return" annotation of the form ""-> expression"" after the '
- 'parameter\n'
- 'list. These annotations can be any valid Python expression. '
- 'The\n'
- 'presence of annotations does not change the semantics of a '
- 'function.\n'
- 'The annotation values are available as values of a dictionary '
- 'keyed by\n'
- 'the parameters\' names in the "__annotations__" attribute of '
+ 'Parameters may have an *annotation* of the form “": '
+ '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'
- 'function object. If the "annotations" import from "__future__" '
- 'is\n'
- 'used, annotations are preserved as strings at runtime which '
- 'enables\n'
- 'postponed evaluation. Otherwise, they are evaluated when the '
- 'function\n'
- 'definition is executed. In this case annotations may be '
- 'evaluated in\n'
- 'a different order than they appear in the source code.\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'
'\n'
'It is also possible to create anonymous functions (functions not '
'bound\n'
@@ -2549,16 +2702,16 @@ topics = {'assert': 'The "assert" statement\n'
'lambda\n'
'expression is merely a shorthand for a simplified function '
'definition;\n'
- 'a function defined in a ""def"" statement can be passed around '
+ 'a function defined in a “"def"” statement can be passed around '
'or\n'
'assigned to another name just like a function defined by a '
'lambda\n'
- 'expression. The ""def"" form is actually more powerful since '
+ 'expression. The “"def"” form is actually more powerful since '
'it\n'
'allows the execution of multiple statements and annotations.\n'
'\n'
- "**Programmer's note:** Functions are first-class objects. A "
- '""def""\n'
+ '**Programmer’s note:** Functions are first-class objects. A '
+ '“"def"”\n'
'statement executed inside a function definition defines a local\n'
'function that can be returned or passed around. Free variables '
'used\n'
@@ -2617,15 +2770,15 @@ topics = {'assert': 'The "assert" statement\n'
' class Foo(object):\n'
' pass\n'
'\n'
- "The class's suite is then executed in a new execution frame "
+ 'The class’s suite is then executed in a new execution frame '
'(see\n'
'Naming and binding), using a newly created local namespace and '
'the\n'
'original global namespace. (Usually, the suite contains mostly\n'
- "function definitions.) When the class's suite finishes "
+ 'function definitions.) When the class’s suite finishes '
'execution, its\n'
'execution frame is discarded but its local namespace is saved. '
- '[4] A\n'
+ '[3] A\n'
'class object is then created using the inheritance list for the '
'base\n'
'classes and the saved local namespace for the attribute '
@@ -2635,7 +2788,7 @@ topics = {'assert': 'The "assert" statement\n'
'namespace.\n'
'\n'
'The order in which attributes are defined in the class body is\n'
- 'preserved in the new class\'s "__dict__". Note that this is '
+ 'preserved in the new class’s "__dict__". Note that this is '
'reliable\n'
'only right after the class is created and only for classes that '
'were\n'
@@ -2660,14 +2813,14 @@ topics = {'assert': 'The "assert" statement\n'
'function decorators. The result is then bound to the class '
'name.\n'
'\n'
- "**Programmer's note:** Variables defined in the class definition "
+ '**Programmer’s note:** Variables defined in the class definition '
'are\n'
'class attributes; they are shared by instances. Instance '
'attributes\n'
'can be set in a method with "self.name = value". Both class '
'and\n'
'instance attributes are accessible through the notation '
- '""self.name"",\n'
+ '“"self.name"”,\n'
'and an instance attribute hides a class attribute with the same '
'name\n'
'when accessed in this way. Class attributes can be used as '
@@ -2677,8 +2830,18 @@ topics = {'assert': 'The "assert" statement\n'
'unexpected results. Descriptors can be used to create instance\n'
'variables with different implementation details.\n'
'\n'
- 'See also: **PEP 3115** - Metaclasses in Python 3 **PEP 3129** -\n'
- ' Class Decorators\n'
+ 'See also:\n'
+ '\n'
+ ' **PEP 3115** - Metaclasses in Python 3000\n'
+ ' The proposal that changed the declaration of metaclasses to '
+ 'the\n'
+ ' current syntax, and the semantics for how classes with\n'
+ ' metaclasses are constructed.\n'
+ '\n'
+ ' **PEP 3129** - Class Decorators\n'
+ ' The proposal that added class decorators. Function and '
+ 'method\n'
+ ' decorators were introduced in **PEP 318**.\n'
'\n'
'\n'
'Coroutines\n'
@@ -2691,24 +2854,25 @@ topics = {'assert': 'The "assert" statement\n'
'-----------------------------\n'
'\n'
' async_funcdef ::= [decorators] "async" "def" funcname "(" '
- '[parameter_list] ")" ["->" expression] ":" suite\n'
+ '[parameter_list] ")"\n'
+ ' ["->" expression] ":" suite\n'
'\n'
'Execution of Python coroutines can be suspended and resumed at '
'many\n'
- 'points (see *coroutine*). In the body of a coroutine, any '
- '"await" and\n'
- '"async" identifiers become reserved keywords; "await" '
- 'expressions,\n'
- '"async for" and "async with" can only be used in coroutine '
- 'bodies.\n'
+ 'points (see *coroutine*). Inside the body of a coroutine '
+ 'function,\n'
+ '"await" and "async" identifiers become reserved keywords; '
+ '"await"\n'
+ 'expressions, "async for" and "async with" can only be used in\n'
+ 'coroutine function bodies.\n'
'\n'
'Functions defined with "async def" syntax are always coroutine\n'
'functions, even if they do not contain "await" or "async" '
'keywords.\n'
'\n'
- 'It is a "SyntaxError" to use "yield from" expressions in "async '
- 'def"\n'
- 'coroutines.\n'
+ 'It is a "SyntaxError" to use a "yield from" expression inside '
+ 'the body\n'
+ 'of a coroutine function.\n'
'\n'
'An example of a coroutine function:\n'
'\n'
@@ -2754,9 +2918,9 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'See also "__aiter__()" and "__anext__()" for details.\n'
'\n'
- 'It is a "SyntaxError" to use "async for" statement outside of '
- 'an\n'
- '"async def" function.\n'
+ 'It is a "SyntaxError" to use an "async for" statement outside '
+ 'the body\n'
+ 'of a coroutine function.\n'
'\n'
'\n'
'The "async with" statement\n'
@@ -2790,11 +2954,16 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'See also "__aenter__()" and "__aexit__()" for details.\n'
'\n'
- 'It is a "SyntaxError" to use "async with" statement outside of '
- 'an\n'
- '"async def" function.\n'
+ 'It is a "SyntaxError" to use an "async with" statement outside '
+ 'the\n'
+ 'body of a coroutine function.\n'
'\n'
- 'See also: **PEP 492** - Coroutines with async and await syntax\n'
+ 'See also:\n'
+ '\n'
+ ' **PEP 492** - Coroutines with async and await syntax\n'
+ ' The proposal that made coroutines a proper standalone '
+ 'concept in\n'
+ ' Python, and added supporting syntax.\n'
'\n'
'-[ Footnotes ]-\n'
'\n'
@@ -2803,20 +2972,14 @@ topics = {'assert': 'The "assert" statement\n'
' exception. That new exception causes the old one to be '
'lost.\n'
'\n'
- '[2] Currently, control "flows off the end" except in the case '
- 'of\n'
- ' an exception or the execution of a "return", "continue", or\n'
- ' "break" statement.\n'
- '\n'
- '[3] A string literal appearing as the first statement in the\n'
- ' function body is transformed into the function\'s "__doc__"\n'
- " attribute and therefore the function's *docstring*.\n"
+ '[2] A string literal appearing as the first statement in the\n'
+ ' function body is transformed into the function’s "__doc__"\n'
+ ' attribute and therefore the function’s *docstring*.\n'
'\n'
- '[4] A string literal appearing as the first statement in the '
+ '[3] A string literal appearing as the first statement in the '
'class\n'
- ' body is transformed into the namespace\'s "__doc__" item '
- 'and\n'
- " therefore the class's *docstring*.\n",
+ ' body is transformed into the namespace’s "__doc__" item and\n'
+ ' therefore the class’s *docstring*.\n',
'context-managers': 'With Statement Context Managers\n'
'*******************************\n'
'\n'
@@ -2846,7 +3009,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Enter the runtime context related to this object. The '
'"with"\n'
- " statement will bind this method's return value to the "
+ ' statement will bind this method’s return value to the '
'target(s)\n'
' specified in the "as" clause of the statement, if '
'any.\n'
@@ -2871,11 +3034,11 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Note that "__exit__()" methods should not reraise the '
'passed-in\n'
- " exception; this is the caller's responsibility.\n"
+ ' exception; this is the caller’s responsibility.\n'
'\n'
'See also:\n'
'\n'
- ' **PEP 343** - The "with" statement\n'
+ ' **PEP 343** - The “with” statement\n'
' The specification, background, and examples for the '
'Python "with"\n'
' statement.\n',
@@ -2886,11 +3049,10 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'"continue" may only occur syntactically nested in a "for" or '
'"while"\n'
- 'loop, but not nested in a function or class definition or '
- '"finally"\n'
- 'clause within that loop. It continues with the next cycle of '
- 'the\n'
- 'nearest enclosing loop.\n'
+ 'loop, but not nested in a function or class definition within '
+ 'that\n'
+ 'loop. It continues with the next cycle of the nearest enclosing '
+ 'loop.\n'
'\n'
'When "continue" passes control out of a "try" statement with a\n'
'"finally" clause, that "finally" clause is executed before '
@@ -2901,7 +3063,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'When a description of an arithmetic operator below uses the '
'phrase\n'
- '"the numeric arguments are converted to a common type," this '
+ '“the numeric arguments are converted to a common type,” this '
'means\n'
'that the operator implementation for built-in types works as '
'follows:\n'
@@ -2919,7 +3081,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'Some additional rules apply for certain operators (e.g., a '
'string as a\n'
- "left argument to the '%' operator). Extensions must define "
+ 'left argument to the ‘%’ operator). Extensions must define '
'their own\n'
'conversion behavior.\n',
'customization': 'Basic customization\n'
@@ -2943,7 +3105,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Typical implementations create a new instance of the '
'class by\n'
- ' invoking the superclass\'s "__new__()" method using\n'
+ ' invoking the superclass’s "__new__()" method using\n'
' "super().__new__(cls[, ...])" with appropriate arguments '
'and then\n'
' modifying the newly-created instance as necessary before '
@@ -2952,7 +3114,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' If "__new__()" returns an instance of *cls*, then the '
'new\n'
- ' instance\'s "__init__()" method will be invoked like\n'
+ ' instance’s "__init__()" method will be invoked like\n'
' "__init__(self[, ...])", where *self* is the new '
'instance and the\n'
' remaining arguments are the same as were passed to '
@@ -2960,7 +3122,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' If "__new__()" does not return an instance of *cls*, '
'then the new\n'
- ' instance\'s "__init__()" method will not be invoked.\n'
+ ' instance’s "__init__()" method will not be invoked.\n'
'\n'
' "__new__()" is intended mainly to allow subclasses of '
'immutable\n'
@@ -2978,7 +3140,7 @@ topics = {'assert': 'The "assert" statement\n'
'those\n'
' passed to the class constructor expression. If a base '
'class has an\n'
- ' "__init__()" method, the derived class\'s "__init__()" '
+ ' "__init__()" method, the derived class’s "__init__()" '
'method, if\n'
' any, must explicitly call it to ensure proper '
'initialization of the\n'
@@ -2999,7 +3161,7 @@ topics = {'assert': 'The "assert" statement\n'
'is also\n'
' called a finalizer or (improperly) a destructor. If a '
'base class\n'
- ' has a "__del__()" method, the derived class\'s '
+ ' has a "__del__()" method, the derived class’s '
'"__del__()" method,\n'
' if any, must explicitly call it to ensure proper '
'deletion of the\n'
@@ -3020,11 +3182,11 @@ topics = {'assert': 'The "assert" statement\n'
'for\n'
' objects that still exist when the interpreter exits.\n'
'\n'
- ' Note: "del x" doesn\'t directly call "x.__del__()" --- '
- 'the former\n'
+ ' Note: "del x" doesn’t directly call "x.__del__()" — the '
+ 'former\n'
' decrements the reference count for "x" by one, and the '
'latter is\n'
- ' only called when "x"\'s reference count reaches zero.\n'
+ ' only called when "x"’s reference count reaches zero.\n'
'\n'
' **CPython implementation detail:** It is possible for a '
'reference\n'
@@ -3036,7 +3198,7 @@ topics = {'assert': 'The "assert" statement\n'
'reference\n'
' cycles is when an exception has been caught in a local '
'variable.\n'
- " The frame's locals then reference the exception, which "
+ ' The frame’s locals then reference the exception, which '
'references\n'
' its own traceback, which references the locals of all '
'frames caught\n'
@@ -3083,7 +3245,7 @@ topics = {'assert': 'The "assert" statement\n'
'object.__repr__(self)\n'
'\n'
' Called by the "repr()" built-in function to compute the '
- '"official"\n'
+ '“official”\n'
' string representation of an object. If at all possible, '
'this\n'
' should look like a valid Python expression that could be '
@@ -3097,7 +3259,7 @@ topics = {'assert': 'The "assert" statement\n'
' value must be a string object. If a class defines '
'"__repr__()" but\n'
' not "__str__()", then "__repr__()" is also used when an '
- '"informal"\n'
+ '“informal”\n'
' string representation of instances of that class is '
'required.\n'
'\n'
@@ -3109,7 +3271,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Called by "str(object)" and the built-in functions '
'"format()" and\n'
- ' "print()" to compute the "informal" or nicely printable '
+ ' "print()" to compute the “informal” or nicely printable '
'string\n'
' representation of an object. The return value must be a '
'string\n'
@@ -3137,7 +3299,7 @@ topics = {'assert': 'The "assert" statement\n'
'extension,\n'
' evaluation of formatted string literals and the '
'"str.format()"\n'
- ' method, to produce a "formatted" string representation '
+ ' method, to produce a “formatted” string representation '
'of an\n'
' object. The "format_spec" argument is a string that '
'contains a\n'
@@ -3173,7 +3335,7 @@ topics = {'assert': 'The "assert" statement\n'
'object.__gt__(self, other)\n'
'object.__ge__(self, other)\n'
'\n'
- ' These are the so-called "rich comparison" methods. The\n'
+ ' These are the so-called “rich comparison” methods. The\n'
' correspondence between operator symbols and method names '
'is as\n'
' follows: "x<y" calls "x.__lt__(y)", "x<=y" calls '
@@ -3220,18 +3382,18 @@ topics = {'assert': 'The "assert" statement\n'
' when the left argument does not support the operation '
'but the right\n'
' argument does); rather, "__lt__()" and "__gt__()" are '
- "each other's\n"
- ' reflection, "__le__()" and "__ge__()" are each other\'s '
+ 'each other’s\n'
+ ' reflection, "__le__()" and "__ge__()" are each other’s '
'reflection,\n'
' and "__eq__()" and "__ne__()" are their own reflection. '
'If the\n'
- " operands are of different types, and right operand's "
+ ' operands are of different types, and right operand’s '
'type is a\n'
- " direct or indirect subclass of the left operand's type, "
+ ' direct or indirect subclass of the left operand’s type, '
'the\n'
' reflected method of the right operand has priority, '
'otherwise the\n'
- " left operand's method has priority. Virtual subclassing "
+ ' left operand’s method has priority. Virtual subclassing '
'is not\n'
' considered.\n'
'\n'
@@ -3255,12 +3417,12 @@ topics = {'assert': 'The "assert" statement\n'
' return hash((self.name, self.nick, self.color))\n'
'\n'
' Note: "hash()" truncates the value returned from an '
- "object's\n"
+ 'object’s\n'
' custom "__hash__()" method to the size of a '
'"Py_ssize_t". This\n'
' is typically 8 bytes on 64-bit builds and 4 bytes on '
'32-bit\n'
- ' builds. If an object\'s "__hash__()" must '
+ ' builds. If an object’s "__hash__()" must '
'interoperate on builds\n'
' of different bit sizes, be sure to check the width on '
'all\n'
@@ -3280,8 +3442,8 @@ topics = {'assert': 'The "assert" statement\n'
'implement\n'
' "__hash__()", since the implementation of hashable '
'collections\n'
- " requires that a key's hash value is immutable (if the "
- "object's hash\n"
+ ' requires that a key’s hash value is immutable (if the '
+ 'object’s hash\n'
' value changes, it will be in the wrong hash bucket).\n'
'\n'
' User-defined classes have "__eq__()" and "__hash__()" '
@@ -3326,7 +3488,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Note: By default, the "__hash__()" values of str, bytes '
'and\n'
- ' datetime objects are "salted" with an unpredictable '
+ ' datetime objects are “salted” with an unpredictable '
'random value.\n'
' Although they remain constant within an individual '
'Python\n'
@@ -3341,12 +3503,12 @@ topics = {'assert': 'The "assert" statement\n'
' See '
'http://www.ocert.org/advisories/ocert-2011-003.html for\n'
' details.Changing hash values affects the iteration '
- 'order of\n'
- ' dicts, sets and other mappings. Python has never made '
- 'guarantees\n'
- ' about this ordering (and it typically varies between '
- '32-bit and\n'
- ' 64-bit builds).See also "PYTHONHASHSEED".\n'
+ 'order of sets.\n'
+ ' Python has never made guarantees about this ordering '
+ '(and it\n'
+ ' typically varies between 32-bit and 64-bit builds).See '
+ 'also\n'
+ ' "PYTHONHASHSEED".\n'
'\n'
' Changed in version 3.3: Hash randomization is enabled by '
'default.\n'
@@ -3364,8 +3526,8 @@ topics = {'assert': 'The "assert" statement\n'
' neither "__len__()" nor "__bool__()", all its instances '
'are\n'
' considered true.\n',
- 'debugger': '"pdb" --- The Python Debugger\n'
- '*****************************\n'
+ 'debugger': '"pdb" — The Python Debugger\n'
+ '***************************\n'
'\n'
'**Source code:** Lib/pdb.py\n'
'\n'
@@ -3383,15 +3545,15 @@ topics = {'assert': 'The "assert" statement\n'
'debugging\n'
'and can be called under program control.\n'
'\n'
- 'The debugger is extensible -- it is actually defined as the '
+ 'The debugger is extensible – it is actually defined as the '
'class\n'
'"Pdb". This is currently undocumented but easily understood by '
'reading\n'
'the source. The extension interface uses the modules "bdb" and '
'"cmd".\n'
'\n'
- 'The debugger\'s prompt is "(Pdb)". Typical usage to run a '
- 'program under\n'
+ 'The debugger’s prompt is "(Pdb)". Typical usage to run a program '
+ 'under\n'
'control of the debugger is:\n'
'\n'
' >>> import pdb\n'
@@ -3423,11 +3585,11 @@ topics = {'assert': 'The "assert" statement\n'
'post-\n'
'mortem debugging (or after normal exit of the program), pdb '
'will\n'
- "restart the program. Automatic restarting preserves pdb's state "
+ 'restart the program. Automatic restarting preserves pdb’s state '
'(such\n'
'as breakpoints) and in most cases is more useful than quitting '
'the\n'
- "debugger upon program's exit.\n"
+ 'debugger upon program’s exit.\n'
'\n'
'New in version 3.2: "pdb.py" now accepts a "-c" option that '
'executes\n'
@@ -3452,6 +3614,10 @@ topics = {'assert': 'The "assert" statement\n'
'running\n'
'without the debugger using the "continue" command.\n'
'\n'
+ 'New in version 3.7: The built-in "breakpoint()", when called '
+ 'with\n'
+ 'defaults, can be used instead of "import pdb; pdb.set_trace()".\n'
+ '\n'
'The typical usage to inspect a crashed program is:\n'
'\n'
' >>> import pdb\n'
@@ -3617,7 +3783,7 @@ topics = {'assert': 'The "assert" statement\n'
'the last command was a "list" command, the next 11 lines are '
'listed.\n'
'\n'
- "Commands that the debugger doesn't recognize are assumed to be "
+ 'Commands that the debugger doesn’t recognize are assumed to be '
'Python\n'
'statements and are executed in the context of the program being\n'
'debugged. Python statements can also be prefixed with an '
@@ -3628,7 +3794,7 @@ topics = {'assert': 'The "assert" statement\n'
'function.\n'
'When an exception occurs in such a statement, the exception name '
'is\n'
- "printed but the debugger's state is not changed.\n"
+ 'printed but the debugger’s state is not changed.\n'
'\n'
'The debugger supports aliases. Aliases can have parameters '
'which\n'
@@ -3645,7 +3811,7 @@ topics = {'assert': 'The "assert" statement\n'
'first\n'
'";;" pair, even if it is in the middle of a quoted string.\n'
'\n'
- 'If a file ".pdbrc" exists in the user\'s home directory or in '
+ 'If a file ".pdbrc" exists in the user’s home directory or in '
'the\n'
'current directory, it is read in and executed as if it had been '
'typed\n'
@@ -3701,7 +3867,7 @@ topics = {'assert': 'The "assert" statement\n'
'prefixed\n'
' with a filename and a colon, to specify a breakpoint in '
'another\n'
- " file (probably one that hasn't been loaded yet). The file "
+ ' file (probably one that hasn’t been loaded yet). The file '
'is\n'
' searched on "sys.path". Note that each breakpoint is '
'assigned a\n'
@@ -3798,7 +3964,7 @@ topics = {'assert': 'The "assert" statement\n'
'"continue",\n'
' "step", "next", "return", "jump", "quit" and their '
'abbreviations)\n'
- ' terminates the command "list" (as if that command was '
+ ' terminates the command list (as if that command was '
'immediately\n'
' followed by end). This is because any time you resume '
'execution\n'
@@ -3806,7 +3972,7 @@ topics = {'assert': 'The "assert" statement\n'
' breakpoint—which could have its own command list, leading to\n'
' ambiguities about which list to execute.\n'
'\n'
- " If you use the 'silent' command in the command list, the "
+ ' If you use the ‘silent’ command in the command list, the '
'usual\n'
' message about stopping at a breakpoint is not printed. This '
'may be\n'
@@ -3865,13 +4031,13 @@ topics = {'assert': 'The "assert" statement\n'
'the\n'
' bottom-most frame. This lets you jump back and execute code '
'again,\n'
- " or jump forward to skip code that you don't want to run.\n"
+ ' or jump forward to skip code that you don’t want to run.\n'
'\n'
- ' It should be noted that not all jumps are allowed -- for '
- 'instance\n'
- ' it is not possible to jump into the middle of a "for" loop or '
- 'out\n'
- ' of a "finally" clause.\n'
+ ' It should be noted that not all jumps are allowed – for '
+ 'instance it\n'
+ ' is not possible to jump into the middle of a "for" loop or '
+ 'out of a\n'
+ ' "finally" clause.\n'
'\n'
'l(ist) [first[, last]]\n'
'\n'
@@ -3914,8 +4080,8 @@ topics = {'assert': 'The "assert" statement\n'
' value.\n'
'\n'
' Note: "print()" can also be used, but is not a debugger '
- 'command\n'
- ' --- this executes the Python "print()" function.\n'
+ 'command —\n'
+ ' this executes the Python "print()" function.\n'
'\n'
'pp expression\n'
'\n'
@@ -4085,7 +4251,7 @@ topics = {'assert': 'The "assert" statement\n'
'dictionary:\n'
'each key object is used as a key into the dictionary to store the\n'
'corresponding datum. This means that you can specify the same key\n'
- "multiple times in the key/datum list, and the final dictionary's "
+ 'multiple times in the key/datum list, and the final dictionary’s '
'value\n'
'for that key will be the last one given.\n'
'\n'
@@ -4099,7 +4265,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'A dict comprehension, in contrast to list and set comprehensions,\n'
'needs two expressions separated with a colon followed by the usual\n'
- '"for" and "if" clauses. When the comprehension is run, the '
+ '“for” and “if” clauses. When the comprehension is run, the '
'resulting\n'
'key and value elements are inserted in the new dictionary in the '
'order\n'
@@ -4142,7 +4308,7 @@ topics = {'assert': 'The "assert" statement\n'
'The "if" statement is used for conditional execution:\n'
'\n'
' if_stmt ::= "if" expression ":" suite\n'
- ' ( "elif" expression ":" suite )*\n'
+ ' ("elif" expression ":" suite)*\n'
' ["else" ":" suite]\n'
'\n'
'It selects exactly one of the suites by evaluating the expressions '
@@ -4173,7 +4339,7 @@ topics = {'assert': 'The "assert" statement\n'
'error (such as division by zero). A Python program can also\n'
'explicitly raise an exception with the "raise" statement. '
'Exception\n'
- 'handlers are specified with the "try" ... "except" statement. '
+ 'handlers are specified with the "try" … "except" statement. '
'The\n'
'"finally" clause of such a statement can be used to specify '
'cleanup\n'
@@ -4181,7 +4347,7 @@ topics = {'assert': 'The "assert" statement\n'
'whether an\n'
'exception occurred or not in the preceding code.\n'
'\n'
- 'Python uses the "termination" model of error handling: an '
+ 'Python uses the “termination” model of error handling: an '
'exception\n'
'handler can find out what happened and continue execution at '
'an outer\n'
@@ -4249,7 +4415,7 @@ topics = {'assert': 'The "assert" statement\n'
'argument to the interpreter) is a code block. A script command '
'(a\n'
'command specified on the interpreter command line with the '
- "'**-c**'\n"
+ '"-c"\n'
'option) is a code block. The string argument passed to the '
'built-in\n'
'functions "eval()" and "exec()" is a code block.\n'
@@ -4258,7 +4424,7 @@ topics = {'assert': 'The "assert" statement\n'
'contains\n'
'some administrative information (used for debugging) and '
'determines\n'
- "where and how execution continues after the code block's "
+ 'where and how execution continues after the code block’s '
'execution has\n'
'completed.\n'
'\n'
@@ -4333,7 +4499,7 @@ topics = {'assert': 'The "assert" statement\n'
'nearest\n'
'enclosing scope. The set of all such scopes visible to a code '
'block\n'
- "is called the block's *environment*.\n"
+ 'is called the block’s *environment*.\n'
'\n'
'When a name is not found at all, a "NameError" exception is '
'raised. If\n'
@@ -4411,7 +4577,7 @@ topics = {'assert': 'The "assert" statement\n'
'the class. The scope of names defined in a class block is '
'limited to\n'
'the class block; it does not extend to the code blocks of '
- 'methods --\n'
+ 'methods –\n'
'this includes comprehensions and generator expressions since '
'they are\n'
'implemented using a function scope. This means that the '
@@ -4439,7 +4605,7 @@ topics = {'assert': 'The "assert" statement\n'
'global\n'
'namespace; this should be a dictionary or a module (in the '
'latter case\n'
- "the module's dictionary is used). By default, when in the "
+ 'the module’s dictionary is used). By default, when in the '
'"__main__"\n'
'module, "__builtins__" is the built-in module "builtins"; when '
'in any\n'
@@ -4494,7 +4660,7 @@ topics = {'assert': 'The "assert" statement\n'
'error (such as division by zero). A Python program can also\n'
'explicitly raise an exception with the "raise" statement. '
'Exception\n'
- 'handlers are specified with the "try" ... "except" statement. '
+ 'handlers are specified with the "try" … "except" statement. '
'The\n'
'"finally" clause of such a statement can be used to specify '
'cleanup\n'
@@ -4502,7 +4668,7 @@ topics = {'assert': 'The "assert" statement\n'
'whether an\n'
'exception occurred or not in the preceding code.\n'
'\n'
- 'Python uses the "termination" model of error handling: an '
+ 'Python uses the “termination” model of error handling: an '
'exception\n'
'handler can find out what happened and continue execution at an '
'outer\n'
@@ -4553,10 +4719,10 @@ topics = {'assert': 'The "assert" statement\n'
'exprlists': 'Expression lists\n'
'****************\n'
'\n'
- ' expression_list ::= expression ( "," expression )* [","]\n'
- ' starred_list ::= starred_item ( "," starred_item )* '
+ ' expression_list ::= expression ("," expression)* [","]\n'
+ ' starred_list ::= starred_item ("," starred_item)* '
'[","]\n'
- ' starred_expression ::= expression | ( starred_item "," )* '
+ ' starred_expression ::= expression | (starred_item ",")* '
'[starred_item]\n'
' starred_item ::= expression | "*" or_expr\n'
'\n'
@@ -4582,7 +4748,7 @@ topics = {'assert': 'The "assert" statement\n'
'(a.k.a. a\n'
'*singleton*); it is optional in all other cases. A single '
'expression\n'
- "without a trailing comma doesn't create a tuple, but rather "
+ 'without a trailing comma doesn’t create a tuple, but rather '
'yields the\n'
'value of that expression. (To create an empty tuple, use an '
'empty pair\n'
@@ -4643,15 +4809,13 @@ topics = {'assert': 'The "assert" statement\n'
'terminates.\n'
'\n'
'A "break" statement executed in the first suite terminates the loop\n'
- 'without executing the "else" clause\'s suite. A "continue" '
- 'statement\n'
+ 'without executing the "else" clause’s suite. A "continue" statement\n'
'executed in the first suite skips the rest of the suite and '
'continues\n'
'with the next item, or with the "else" clause if there is no next\n'
'item.\n'
'\n'
- 'The for-loop makes assignments to the variables(s) in the target '
- 'list.\n'
+ 'The for-loop makes assignments to the variables in the target list.\n'
'This overwrites all previous assignments to those variables '
'including\n'
'those made in the suite of the for-loop:\n'
@@ -4666,12 +4830,12 @@ topics = {'assert': 'The "assert" statement\n'
'Names in the target list are not deleted when the loop is finished,\n'
'but if the sequence is empty, they will not have been assigned to at\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 '
+ '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: There is a subtlety when the sequence is being modified by the\n'
- ' loop (this can only occur for mutable sequences, i.e. lists). An\n'
+ ' loop (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 '
@@ -4702,7 +4866,7 @@ topics = {'assert': 'The "assert" statement\n'
'are\n'
'differences.\n'
'\n'
- 'Format strings contain "replacement fields" surrounded by '
+ 'Format strings contain “replacement fields” surrounded by '
'curly braces\n'
'"{}". Anything that is not contained in braces is '
'considered literal\n'
@@ -4718,9 +4882,9 @@ topics = {'assert': 'The "assert" statement\n'
'conversion] [":" format_spec] "}"\n'
' field_name ::= arg_name ("." attribute_name | '
'"[" element_index "]")*\n'
- ' arg_name ::= [identifier | integer]\n'
+ ' arg_name ::= [identifier | digit+]\n'
' attribute_name ::= identifier\n'
- ' element_index ::= integer | index_string\n'
+ ' element_index ::= digit+ | index_string\n'
' index_string ::= <any source character except '
'"]"> +\n'
' conversion ::= "r" | "s" | "a"\n'
@@ -4745,33 +4909,37 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'The *field_name* itself begins with an *arg_name* that is '
'either a\n'
- "number or a keyword. If it's a number, it refers to a "
+ 'number or a keyword. If it’s a number, it refers to a '
'positional\n'
- "argument, and if it's a keyword, it refers to a named "
+ 'argument, and if it’s a keyword, it refers to a named '
'keyword\n'
'argument. If the numerical arg_names in a format string '
'are 0, 1, 2,\n'
- '... in sequence, they can all be omitted (not just some) '
- 'and the\n'
- 'numbers 0, 1, 2, ... will be automatically inserted in that '
- 'order.\n'
- 'Because *arg_name* is not quote-delimited, it is not '
- 'possible to\n'
- 'specify arbitrary dictionary keys (e.g., the strings '
- '"\'10\'" or\n'
- '"\':-]\'") within a format string. The *arg_name* can be '
- 'followed by any\n'
- 'number of index or attribute expressions. An expression of '
- 'the form\n'
- '"\'.name\'" selects the named attribute using "getattr()", '
- 'while an\n'
- 'expression of the form "\'[index]\'" does an index lookup '
- 'using\n'
- '"__getitem__()".\n'
+ '… in sequence, they can all be omitted (not just some) and '
+ 'the numbers\n'
+ '0, 1, 2, … will be automatically inserted in that order. '
+ 'Because\n'
+ '*arg_name* is not quote-delimited, it is not possible to '
+ 'specify\n'
+ 'arbitrary dictionary keys (e.g., the strings "\'10\'" or '
+ '"\':-]\'") within\n'
+ 'a format string. The *arg_name* can be followed by any '
+ 'number of index\n'
+ 'or attribute expressions. An expression of the form '
+ '"\'.name\'" selects\n'
+ 'the named attribute using "getattr()", while an expression '
+ 'of the form\n'
+ '"\'[index]\'" does an index lookup using "__getitem__()".\n'
'\n'
'Changed in version 3.1: The positional argument specifiers '
'can be\n'
- 'omitted, so "\'{} {}\'" is equivalent to "\'{0} {1}\'".\n'
+ 'omitted for "str.format()", so "\'{} {}\'.format(a, b)" is '
+ 'equivalent to\n'
+ '"\'{0} {1}\'.format(a, b)".\n'
+ '\n'
+ 'Changed in version 3.4: The positional argument specifiers '
+ 'can be\n'
+ 'omitted for "Formatter".\n'
'\n'
'Some simple format string examples:\n'
'\n'
@@ -4822,7 +4990,7 @@ topics = {'assert': 'The "assert" statement\n'
'alignment,\n'
'padding, decimal precision and so on. Each value type can '
'define its\n'
- 'own "formatting mini-language" or interpretation of the '
+ 'own “formatting mini-language” or interpretation of the '
'*format_spec*.\n'
'\n'
'Most built-in types support a common formatting '
@@ -4848,7 +5016,7 @@ topics = {'assert': 'The "assert" statement\n'
'Format Specification Mini-Language\n'
'==================================\n'
'\n'
- '"Format specifications" are used within replacement fields '
+ '“Format specifications” are used within replacement fields '
'contained\n'
'within a format string to define how individual values are '
'presented\n'
@@ -4879,9 +5047,9 @@ topics = {'assert': 'The "assert" statement\n'
' fill ::= <any character>\n'
' align ::= "<" | ">" | "=" | "^"\n'
' sign ::= "+" | "-" | " "\n'
- ' width ::= integer\n'
+ ' width ::= digit+\n'
' grouping_option ::= "_" | ","\n'
- ' precision ::= integer\n'
+ ' precision ::= digit+\n'
' type ::= "b" | "c" | "d" | "e" | "E" | "f" | '
'"F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n'
'\n'
@@ -4890,13 +5058,13 @@ topics = {'assert': 'The "assert" statement\n'
'character that can be any character and defaults to a space '
'if\n'
'omitted. It is not possible to use a literal curly brace '
- '(""{"" or\n'
- '""}"") as the *fill* character in a formatted string '
+ '(“"{"” or\n'
+ '“"}"”) as the *fill* character in a formatted string '
'literal or when\n'
'using the "str.format()" method. However, it is possible '
'to insert a\n'
'curly brace with a nested replacement field. This '
- "limitation doesn't\n"
+ 'limitation doesn’t\n'
'affect the "format()" function.\n'
'\n'
'The meaning of the various alignment options is as '
@@ -4925,10 +5093,10 @@ topics = {'assert': 'The "assert" statement\n'
'the sign (if any) |\n'
' | | but before the digits. This is used for '
'printing fields |\n'
- " | | in the form '+000000120'. This alignment "
+ ' | | in the form ‘+000000120’. This alignment '
'option is only |\n'
' | | valid for numeric types. It becomes the '
- "default when '0' |\n"
+ 'default when ‘0’ |\n'
' | | immediately precedes the field '
'width. |\n'
' '
@@ -4977,7 +5145,7 @@ topics = {'assert': 'The "assert" statement\n'
' '
'+-----------+------------------------------------------------------------+\n'
'\n'
- 'The "\'#\'" option causes the "alternate form" to be used '
+ 'The "\'#\'" option causes the “alternate form” to be used '
'for the\n'
'conversion. The alternate form is defined differently for '
'different\n'
@@ -5146,7 +5314,7 @@ topics = {'assert': 'The "assert" statement\n'
'+===========+============================================================+\n'
' | "\'e\'" | Exponent notation. Prints the number in '
'scientific |\n'
- " | | notation using the letter 'e' to indicate "
+ ' | | notation using the letter ‘e’ to indicate '
'the exponent. |\n'
' | | The default precision is '
'"6". |\n'
@@ -5154,20 +5322,20 @@ topics = {'assert': 'The "assert" statement\n'
'+-----------+------------------------------------------------------------+\n'
' | "\'E\'" | Exponent notation. Same as "\'e\'" '
'except it uses an upper |\n'
- " | | case 'E' as the separator "
+ ' | | case ‘E’ as the separator '
'character. |\n'
' '
'+-----------+------------------------------------------------------------+\n'
- ' | "\'f\'" | Fixed point. Displays the number as a '
- 'fixed-point number. |\n'
- ' | | The default precision is '
- '"6". |\n'
+ ' | "\'f\'" | Fixed-point notation. Displays the '
+ 'number as a fixed-point |\n'
+ ' | | number. The default precision is '
+ '"6". |\n'
' '
'+-----------+------------------------------------------------------------+\n'
- ' | "\'F\'" | Fixed point. Same as "\'f\'", but '
- 'converts "nan" to "NAN" |\n'
- ' | | and "inf" to '
- '"INF". |\n'
+ ' | "\'F\'" | Fixed-point notation. Same as "\'f\'", '
+ 'but converts "nan" to |\n'
+ ' | | "NAN" and "inf" to '
+ '"INF". |\n'
' '
'+-----------+------------------------------------------------------------+\n'
' | "\'g\'" | General format. For a given precision '
@@ -5262,7 +5430,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'The new format syntax also supports new and different '
'options, shown\n'
- 'in the follow examples.\n'
+ 'in the following examples.\n'
'\n'
'Accessing arguments by position:\n'
'\n'
@@ -5291,7 +5459,7 @@ topics = {'assert': 'The "assert" statement\n'
"{longitude}'.format(**coord)\n"
" 'Coordinates: 37.24N, -115.81W'\n"
'\n'
- "Accessing arguments' attributes:\n"
+ 'Accessing arguments’ attributes:\n'
'\n'
' >>> c = 3-5j\n'
" >>> ('The complex number {0} is formed from the real "
@@ -5309,7 +5477,7 @@ topics = {'assert': 'The "assert" statement\n'
' >>> str(Point(4, 2))\n'
" 'Point(4, 2)'\n"
'\n'
- "Accessing arguments' items:\n"
+ 'Accessing arguments’ items:\n'
'\n'
' >>> coord = (3, 5)\n'
" >>> 'X: {0[0]}; Y: {0[1]}'.format(coord)\n"
@@ -5394,8 +5562,7 @@ topics = {'assert': 'The "assert" statement\n'
' 3232235521\n'
' >>>\n'
' >>> width = 5\n'
- ' >>> for num in range(5,12): #doctest: '
- '+NORMALIZE_WHITESPACE\n'
+ ' >>> for num in range(5,12): \n'
" ... for base in 'dXob':\n"
" ... print('{0:{width}{base}}'.format(num, "
"base=base, width=width), end=' ')\n"
@@ -5416,7 +5583,8 @@ topics = {'assert': 'The "assert" statement\n'
'section The standard type hierarchy):\n'
'\n'
' funcdef ::= [decorators] "def" funcname "(" '
- '[parameter_list] ")" ["->" expression] ":" suite\n'
+ '[parameter_list] ")"\n'
+ ' ["->" expression] ":" suite\n'
' decorators ::= decorator+\n'
' decorator ::= "@" dotted_name ["(" '
'[argument_list [","]] ")"] NEWLINE\n'
@@ -5442,7 +5610,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'The function definition does not execute the function body; this '
'gets\n'
- 'executed only when the function is called. [3]\n'
+ 'executed only when the function is called. [2]\n'
'\n'
'A function definition may be wrapped by one or more *decorator*\n'
'expressions. Decorator expressions are evaluated when the '
@@ -5471,25 +5639,24 @@ topics = {'assert': 'The "assert" statement\n'
'"func".\n'
'\n'
'When one or more *parameters* have the form *parameter* "="\n'
- '*expression*, the function is said to have "default parameter '
- 'values."\n'
+ '*expression*, the function is said to have “default parameter '
+ 'values.”\n'
'For a parameter with a default value, the corresponding '
'*argument* may\n'
- "be omitted from a call, in which case the parameter's default "
+ 'be omitted from a call, in which case the parameter’s default '
'value is\n'
'substituted. If a parameter has a default value, all following\n'
- 'parameters up until the ""*"" must also have a default value --- '
- 'this\n'
- 'is a syntactic restriction that is not expressed by the '
- 'grammar.\n'
+ 'parameters up until the “"*"” must also have a default value — '
+ 'this is\n'
+ 'a syntactic restriction that is not expressed by the grammar.\n'
'\n'
'**Default parameter values are evaluated from left to right when '
'the\n'
'function definition is executed.** This means that the '
'expression is\n'
'evaluated once, when the function is defined, and that the same '
- '"pre-\n'
- 'computed" value is used for each call. This is especially '
+ '“pre-\n'
+ 'computed” value is used for each call. This is especially '
'important\n'
'to understand when a default parameter is a mutable object, such '
'as a\n'
@@ -5515,44 +5682,44 @@ topics = {'assert': 'The "assert" statement\n'
'mentioned in\n'
'the parameter list, either from position arguments, from '
'keyword\n'
- 'arguments, or from default values. If the form ""*identifier"" '
+ 'arguments, or from default values. If the form “"*identifier"” '
'is\n'
'present, it is initialized to a tuple receiving any excess '
'positional\n'
'parameters, defaulting to the empty tuple. If the form\n'
- '""**identifier"" is present, it is initialized to a new ordered\n'
+ '“"**identifier"” is present, it is initialized to a new ordered\n'
'mapping receiving any excess keyword arguments, defaulting to a '
'new\n'
- 'empty mapping of the same type. Parameters after ""*"" or\n'
- '""*identifier"" are keyword-only parameters and may only be '
+ 'empty mapping of the same type. Parameters after “"*"” or\n'
+ '“"*identifier"” are keyword-only parameters and may only be '
'passed\n'
'used keyword arguments.\n'
'\n'
- 'Parameters may have annotations of the form "": expression"" '
- 'following\n'
- 'the parameter name. Any parameter may have an annotation even '
- 'those\n'
- 'of the form "*identifier" or "**identifier". Functions may '
- 'have\n'
- '"return" annotation of the form ""-> expression"" after the '
- 'parameter\n'
- 'list. These annotations can be any valid Python expression. '
- 'The\n'
- 'presence of annotations does not change the semantics of a '
- 'function.\n'
- 'The annotation values are available as values of a dictionary '
- 'keyed by\n'
- 'the parameters\' names in the "__annotations__" attribute of '
+ 'Parameters may have an *annotation* of the form “": '
+ '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'
- 'function object. If the "annotations" import from "__future__" '
- 'is\n'
- 'used, annotations are preserved as strings at runtime which '
- 'enables\n'
- 'postponed evaluation. Otherwise, they are evaluated when the '
- 'function\n'
- 'definition is executed. In this case annotations may be '
- 'evaluated in\n'
- 'a different order than they appear in the source code.\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'
'\n'
'It is also possible to create anonymous functions (functions not '
'bound\n'
@@ -5561,16 +5728,16 @@ topics = {'assert': 'The "assert" statement\n'
'lambda\n'
'expression is merely a shorthand for a simplified function '
'definition;\n'
- 'a function defined in a ""def"" statement can be passed around '
+ 'a function defined in a “"def"” statement can be passed around '
'or\n'
'assigned to another name just like a function defined by a '
'lambda\n'
- 'expression. The ""def"" form is actually more powerful since '
+ 'expression. The “"def"” form is actually more powerful since '
'it\n'
'allows the execution of multiple statements and annotations.\n'
'\n'
- "**Programmer's note:** Functions are first-class objects. A "
- '""def""\n'
+ '**Programmer’s note:** Functions are first-class objects. A '
+ '“"def"”\n'
'statement executed inside a function definition defines a local\n'
'function that can be returned or passed around. Free variables '
'used\n'
@@ -5629,8 +5796,7 @@ topics = {'assert': 'The "assert" statement\n'
'change\n'
'the meaning of the program.\n'
'\n'
- '**Programmer\'s note:** "global" is a directive to the parser. '
- 'It\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'
'statement. In particular, a "global" statement contained in a '
'string\n'
@@ -5687,7 +5853,7 @@ topics = {'assert': 'The "assert" statement\n'
'within the\n'
' context of a class definition, are re-written to use a '
'mangled form\n'
- ' to help avoid name clashes between "private" attributes of '
+ ' to help avoid name clashes between “private” attributes of '
'base and\n'
' derived classes. See section Identifiers (Names).\n',
'identifiers': 'Identifiers and keywords\n'
@@ -5835,7 +6001,7 @@ topics = {'assert': 'The "assert" statement\n'
'within the\n'
' context of a class definition, are re-written to use a '
'mangled form\n'
- ' to help avoid name clashes between "private" attributes of '
+ ' to help avoid name clashes between “private” attributes of '
'base and\n'
' derived classes. See section Identifiers (Names).\n',
'if': 'The "if" statement\n'
@@ -5844,7 +6010,7 @@ topics = {'assert': 'The "assert" statement\n'
'The "if" statement is used for conditional execution:\n'
'\n'
' if_stmt ::= "if" expression ":" suite\n'
- ' ( "elif" expression ":" suite )*\n'
+ ' ("elif" expression ":" suite)*\n'
' ["else" ":" suite]\n'
'\n'
'It selects exactly one of the suites by evaluating the expressions '
@@ -5877,18 +6043,17 @@ topics = {'assert': 'The "assert" statement\n'
'import': 'The "import" statement\n'
'**********************\n'
'\n'
- ' import_stmt ::= "import" module ["as" name] ( "," module '
- '["as" name] )*\n'
+ ' import_stmt ::= "import" module ["as" identifier] ("," '
+ 'module ["as" identifier])*\n'
' | "from" relative_module "import" identifier '
- '["as" name]\n'
- ' ( "," identifier ["as" name] )*\n'
+ '["as" identifier]\n'
+ ' ("," identifier ["as" identifier])*\n'
' | "from" relative_module "import" "(" '
- 'identifier ["as" name]\n'
- ' ( "," identifier ["as" name] )* [","] ")"\n'
+ 'identifier ["as" identifier]\n'
+ ' ("," identifier ["as" identifier])* [","] ")"\n'
' | "from" module "import" "*"\n'
' module ::= (identifier ".")* identifier\n'
' relative_module ::= "."* module | "."+\n'
- ' name ::= identifier\n'
'\n'
'The basic import statement (no "from" clause) is executed in two\n'
'steps:\n'
@@ -5916,7 +6081,7 @@ topics = {'assert': 'The "assert" statement\n'
'either\n'
'that the module could not be located, *or* that an error occurred\n'
'while initializing the module, which includes execution of the\n'
- "module's code.\n"
+ 'module’s code.\n'
'\n'
'If the requested module is retrieved successfully, it will be '
'made\n'
@@ -5927,7 +6092,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'* If no other name is specified, and the module being imported is '
'a\n'
- " top level module, the module's name is bound in the local "
+ ' top level module, the module’s name is bound in the local '
'namespace\n'
' as a reference to the imported module\n'
'\n'
@@ -5980,7 +6145,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'The *public names* defined by a module are determined by checking '
'the\n'
- 'module\'s namespace for a variable named "__all__"; if defined, it '
+ 'module’s namespace for a variable named "__all__"; if defined, it '
'must\n'
'be a sequence of strings which are names defined or imported by '
'that\n'
@@ -5988,7 +6153,7 @@ topics = {'assert': 'The "assert" statement\n'
'and\n'
'are required to exist. If "__all__" is not defined, the set of '
'public\n'
- "names includes all names found in the module's namespace which do "
+ 'names includes all names found in the module’s namespace which do '
'not\n'
'begin with an underscore character ("\'_\'"). "__all__" should '
'contain\n'
@@ -5998,8 +6163,7 @@ topics = {'assert': 'The "assert" statement\n'
'were\n'
'imported and used within the module).\n'
'\n'
- 'The wild card form of import --- "from module import *" --- is '
- 'only\n'
+ 'The wild card form of import — "from module import *" — is only\n'
'allowed at the module level. Attempting to use it in class or\n'
'function definitions will raise a "SyntaxError".\n'
'\n'
@@ -6049,14 +6213,13 @@ topics = {'assert': 'The "assert" statement\n'
'allows use of the new features on a per-module basis before the\n'
'release in which the feature becomes standard.\n'
'\n'
- ' future_statement ::= "from" "__future__" "import" feature ["as" '
- 'name]\n'
- ' ("," feature ["as" name])*\n'
- ' | "from" "__future__" "import" "(" feature '
- '["as" name]\n'
- ' ("," feature ["as" name])* [","] ")"\n'
- ' feature ::= identifier\n'
- ' name ::= identifier\n'
+ ' future_stmt ::= "from" "__future__" "import" feature ["as" '
+ 'identifier]\n'
+ ' ("," feature ["as" identifier])*\n'
+ ' | "from" "__future__" "import" "(" feature '
+ '["as" identifier]\n'
+ ' ("," feature ["as" identifier])* [","] ")"\n'
+ ' feature ::= identifier\n'
'\n'
'A future statement must appear near the top of the module. The '
'only\n'
@@ -6112,7 +6275,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' import __future__ [as name]\n'
'\n'
- "That is not a future statement; it's an ordinary import statement "
+ 'That is not a future statement; it’s an ordinary import statement '
'with\n'
'no special semantics or syntax restrictions.\n'
'\n'
@@ -6123,8 +6286,7 @@ topics = {'assert': 'The "assert" statement\n'
'the\n'
'future statement. This can be controlled by optional arguments '
'to\n'
- '"compile()" --- see the documentation of that function for '
- 'details.\n'
+ '"compile()" — see the documentation of that function for details.\n'
'\n'
'A future statement typed at an interactive interpreter prompt '
'will\n'
@@ -6225,19 +6387,20 @@ topics = {'assert': 'The "assert" statement\n'
'lambda': 'Lambdas\n'
'*******\n'
'\n'
- ' lambda_expr ::= "lambda" [parameter_list]: expression\n'
- ' lambda_expr_nocond ::= "lambda" [parameter_list]: '
+ ' lambda_expr ::= "lambda" [parameter_list] ":" '
+ 'expression\n'
+ ' lambda_expr_nocond ::= "lambda" [parameter_list] ":" '
'expression_nocond\n'
'\n'
'Lambda expressions (sometimes called lambda forms) are used to '
'create\n'
- 'anonymous functions. The expression "lambda arguments: '
+ 'anonymous functions. The expression "lambda parameters: '
'expression"\n'
'yields a function object. The unnamed object behaves like a '
'function\n'
'object defined with:\n'
'\n'
- ' def <lambda>(arguments):\n'
+ ' def <lambda>(parameters):\n'
' return expression\n'
'\n'
'See section Function definitions for the syntax of parameter '
@@ -6330,7 +6493,7 @@ topics = {'assert': 'The "assert" statement\n'
'nearest\n'
'enclosing scope. The set of all such scopes visible to a code '
'block\n'
- "is called the block's *environment*.\n"
+ 'is called the block’s *environment*.\n'
'\n'
'When a name is not found at all, a "NameError" exception is '
'raised. If\n'
@@ -6404,7 +6567,7 @@ topics = {'assert': 'The "assert" statement\n'
'the class. The scope of names defined in a class block is limited '
'to\n'
'the class block; it does not extend to the code blocks of methods '
- '--\n'
+ '–\n'
'this includes comprehensions and generator expressions since they '
'are\n'
'implemented using a function scope. This means that the '
@@ -6431,7 +6594,7 @@ topics = {'assert': 'The "assert" statement\n'
'global\n'
'namespace; this should be a dictionary or a module (in the latter '
'case\n'
- "the module's dictionary is used). By default, when in the "
+ 'the module’s dictionary is used). By default, when in the '
'"__main__"\n'
'module, "__builtins__" is the built-in module "builtins"; when in '
'any\n'
@@ -6507,7 +6670,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'Note that numeric literals do not include a sign; a phrase like '
'"-1"\n'
- 'is actually an expression composed of the unary operator \'"-"\' '
+ 'is actually an expression composed of the unary operator ‘"-"‘ '
'and the\n'
'literal "1".\n',
'numeric-types': 'Emulating numeric types\n'
@@ -6597,15 +6760,15 @@ topics = {'assert': 'The "assert" statement\n'
'"__rpow__()" (the\n'
' coercion rules would become too complicated).\n'
'\n'
- " Note: If the right operand's type is a subclass of the "
+ ' Note: If the right operand’s type is a subclass of the '
'left\n'
- " operand's type and that subclass provides the "
+ ' operand’s type and that subclass provides the '
'reflected method\n'
' for the operation, this method will be called before '
'the left\n'
- " operand's non-reflected method. This behavior allows "
+ ' operand’s non-reflected method. This behavior allows '
'subclasses\n'
- " to override their ancestors' operations.\n"
+ ' to override their ancestors’ operations.\n'
'\n'
'object.__iadd__(self, other)\n'
'object.__isub__(self, other)\n'
@@ -6643,7 +6806,7 @@ topics = {'assert': 'The "assert" statement\n'
'certain\n'
' situations, augmented assignment can result in '
'unexpected errors\n'
- " (see Why does a_tuple[i] += ['item'] raise an exception "
+ ' (see Why does a_tuple[i] += [‘item’] raise an exception '
'when the\n'
' addition works?), but this behavior is in fact part of '
'the data\n'
@@ -6661,13 +6824,11 @@ topics = {'assert': 'The "assert" statement\n'
'object.__complex__(self)\n'
'object.__int__(self)\n'
'object.__float__(self)\n'
- 'object.__round__(self[, n])\n'
'\n'
' Called to implement the built-in functions "complex()", '
- '"int()",\n'
- ' "float()" and "round()". Should return a value of the '
- 'appropriate\n'
- ' type.\n'
+ '"int()" and\n'
+ ' "float()". Should return a value of the appropriate '
+ 'type.\n'
'\n'
'object.__index__(self)\n'
'\n'
@@ -6685,22 +6846,40 @@ topics = {'assert': 'The "assert" statement\n'
'when\n'
' "__index__()" is defined "__int__()" should also be '
'defined, and\n'
- ' both should return the same value.\n',
+ ' both should return the same value.\n'
+ '\n'
+ 'object.__round__(self[, ndigits])\n'
+ 'object.__trunc__(self)\n'
+ 'object.__floor__(self)\n'
+ 'object.__ceil__(self)\n'
+ '\n'
+ ' Called to implement the built-in function "round()" and '
+ '"math"\n'
+ ' functions "trunc()", "floor()" and "ceil()". Unless '
+ '*ndigits* is\n'
+ ' passed to "__round__()" all these methods should return '
+ 'the value\n'
+ ' of the object truncated to an "Integral" (typically an '
+ '"int").\n'
+ '\n'
+ ' If "__int__()" is not defined then the built-in function '
+ '"int()"\n'
+ ' falls back to "__trunc__()".\n',
'objects': 'Objects, values and types\n'
'*************************\n'
'\n'
- "*Objects* are Python's abstraction for data. All data in a "
+ '*Objects* are Python’s abstraction for data. All data in a '
'Python\n'
'program is represented by objects or by relations between '
'objects. (In\n'
- 'a sense, and in conformance to Von Neumann\'s model of a "stored\n'
- 'program computer," code is also represented by objects.)\n'
+ 'a sense, and in conformance to Von Neumann’s model of a “stored\n'
+ 'program computer,” code is also represented by objects.)\n'
'\n'
- "Every object has an identity, a type and a value. An object's\n"
+ 'Every object has an identity, a type and a value. An object’s\n'
'*identity* never changes once it has been created; you may think '
'of it\n'
- 'as the object\'s address in memory. The \'"is"\' operator '
- 'compares the\n'
+ 'as the object’s address in memory. The ‘"is"’ operator compares '
+ 'the\n'
'identity of two objects; the "id()" function returns an integer\n'
'representing its identity.\n'
'\n'
@@ -6708,14 +6887,14 @@ topics = {'assert': 'The "assert" statement\n'
'memory\n'
'address where "x" is stored.\n'
'\n'
- "An object's type determines the operations that the object "
+ 'An object’s type determines the operations that the object '
'supports\n'
- '(e.g., "does it have a length?") and also defines the possible '
+ '(e.g., “does it have a length?”) and also defines the possible '
'values\n'
'for objects of that type. The "type()" function returns an '
- "object's\n"
+ 'object’s\n'
'type (which is an object itself). Like its identity, an '
- "object's\n"
+ 'object’s\n'
'*type* is also unchangeable. [1]\n'
'\n'
'The *value* of some objects can change. Objects whose value can\n'
@@ -6724,14 +6903,14 @@ topics = {'assert': 'The "assert" statement\n'
'once they are created are called *immutable*. (The value of an\n'
'immutable container object that contains a reference to a '
'mutable\n'
- "object can change when the latter's value is changed; however "
+ 'object can change when the latter’s value is changed; however '
'the\n'
'container is still considered immutable, because the collection '
'of\n'
'objects it contains cannot be changed. So, immutability is not\n'
'strictly the same as having an unchangeable value, it is more '
'subtle.)\n'
- "An object's mutability is determined by its type; for instance,\n"
+ 'An object’s mutability is determined by its type; for instance,\n'
'numbers, strings and tuples are immutable, while dictionaries '
'and\n'
'lists are mutable.\n'
@@ -6739,9 +6918,9 @@ topics = {'assert': 'The "assert" statement\n'
'Objects are never explicitly destroyed; however, when they '
'become\n'
'unreachable they may be garbage-collected. An implementation is\n'
- 'allowed to postpone garbage collection or omit it altogether --- '
- 'it is\n'
- 'a matter of implementation quality how garbage collection is\n'
+ 'allowed to postpone garbage collection or omit it altogether — it '
+ 'is a\n'
+ 'matter of implementation quality how garbage collection is\n'
'implemented, as long as no objects are collected that are still\n'
'reachable.\n'
'\n'
@@ -6761,13 +6940,14 @@ topics = {'assert': 'The "assert" statement\n'
'(so\n'
'you should always close files explicitly).\n'
'\n'
- "Note that the use of the implementation's tracing or debugging\n"
+ 'Note that the use of the implementation’s tracing or debugging\n'
'facilities may keep objects alive that would normally be '
'collectable.\n'
- 'Also note that catching an exception with a \'"try"..."except"\'\n'
- 'statement may keep objects alive.\n'
+ 'Also note that catching an exception with a ‘"try"…"except"’ '
+ 'statement\n'
+ 'may keep objects alive.\n'
'\n'
- 'Some objects contain references to "external" resources such as '
+ 'Some objects contain references to “external” resources such as '
'open\n'
'files or windows. It is understood that these resources are '
'freed\n'
@@ -6778,14 +6958,13 @@ topics = {'assert': 'The "assert" statement\n'
'release the external resource, usually a "close()" method. '
'Programs\n'
'are strongly recommended to explicitly close such objects. The\n'
- '\'"try"..."finally"\' statement and the \'"with"\' statement '
- 'provide\n'
+ '‘"try"…"finally"’ statement and the ‘"with"’ statement provide\n'
'convenient ways to do this.\n'
'\n'
'Some objects contain references to other objects; these are '
'called\n'
'*containers*. Examples of containers are tuples, lists and\n'
- "dictionaries. The references are part of a container's value. "
+ 'dictionaries. The references are part of a container’s value. '
'In\n'
'most cases, when we talk about the value of a container, we imply '
'the\n'
@@ -6842,7 +7021,7 @@ topics = {'assert': 'The "assert" statement\n'
'| "lambda" | '
'Lambda expression |\n'
'+-------------------------------------------------+---------------------------------------+\n'
- '| "if" -- "else" | '
+ '| "if" – "else" | '
'Conditional expression |\n'
'+-------------------------------------------------+---------------------------------------+\n'
'| "or" | '
@@ -6925,7 +7104,7 @@ topics = {'assert': 'The "assert" statement\n'
'application.\n'
'\n'
'[2] If x is very close to an exact integer multiple of '
- "y, it's\n"
+ 'y, it’s\n'
' possible for "x//y" to be one larger than '
'"(x-x%y)//y" due to\n'
' rounding. In such cases, Python returns the latter '
@@ -6936,8 +7115,8 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'[3] The Unicode standard distinguishes between *code '
'points* (e.g.\n'
- ' U+0041) and *abstract characters* (e.g. "LATIN '
- 'CAPITAL LETTER A").\n'
+ ' U+0041) and *abstract characters* (e.g. “LATIN '
+ 'CAPITAL LETTER A”).\n'
' While most abstract characters in Unicode are only '
'represented\n'
' using one code point, there is a number of abstract '
@@ -6945,8 +7124,8 @@ topics = {'assert': 'The "assert" statement\n'
' that can in addition be represented using a sequence '
'of more than\n'
' one code point. For example, the abstract character '
- '"LATIN\n'
- ' CAPITAL LETTER C WITH CEDILLA" can be represented as '
+ '“LATIN\n'
+ ' CAPITAL LETTER C WITH CEDILLA” can be represented as '
'a single\n'
' *precomposed character* at code position U+00C7, or '
'as a sequence\n'
@@ -6962,9 +7141,9 @@ topics = {'assert': 'The "assert" statement\n'
'to humans. For\n'
' example, ""\\u00C7" == "\\u0043\\u0327"" is "False", '
'even though both\n'
- ' strings represent the same abstract character "LATIN '
+ ' strings represent the same abstract character “LATIN '
'CAPITAL\n'
- ' LETTER C WITH CEDILLA".\n'
+ ' LETTER C WITH CEDILLA”.\n'
'\n'
' To compare strings at the level of abstract '
'characters (that is,\n'
@@ -6994,10 +7173,11 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' pass_stmt ::= "pass"\n'
'\n'
- '"pass" is a null operation --- when it is executed, nothing '
- 'happens.\n'
- 'It is useful as a placeholder when a statement is required\n'
- 'syntactically, but no code needs to be executed, for example:\n'
+ '"pass" is a null operation — when it is executed, nothing happens. '
+ 'It\n'
+ 'is useful as a placeholder when a statement is required '
+ 'syntactically,\n'
+ 'but no code needs to be executed, for example:\n'
'\n'
' def f(arg): pass # a function that does nothing (yet)\n'
'\n'
@@ -7010,7 +7190,7 @@ topics = {'assert': 'The "assert" statement\n'
'The\n'
'syntax is:\n'
'\n'
- ' power ::= ( await_expr | primary ) ["**" u_expr]\n'
+ ' power ::= (await_expr | primary) ["**" u_expr]\n'
'\n'
'Thus, in an unparenthesized sequence of power and unary operators, '
'the\n'
@@ -7053,7 +7233,7 @@ topics = {'assert': 'The "assert" statement\n'
'"BaseException". If it is a class, the exception instance will be\n'
'obtained when needed by instantiating the class with no arguments.\n'
'\n'
- "The *type* of the exception is the exception instance's class, the\n"
+ 'The *type* of the exception is the exception instance’s class, the\n'
'*value* is the instance itself.\n'
'\n'
'A traceback object is normally created automatically when an '
@@ -7099,7 +7279,7 @@ topics = {'assert': 'The "assert" statement\n'
'inside\n'
'an exception handler or a "finally" clause: the previous exception '
'is\n'
- 'then attached as the new exception\'s "__context__" attribute:\n'
+ 'then attached as the new exception’s "__context__" attribute:\n'
'\n'
' >>> try:\n'
' ... print(1 / 0)\n'
@@ -7199,7 +7379,7 @@ topics = {'assert': 'The "assert" statement\n'
'"clear()",\n'
'"setdefault()", "pop()", "popitem()", "copy()", and '
'"update()"\n'
- "behaving similar to those for Python's standard dictionary "
+ 'behaving similar to those for Python’s standard dictionary '
'objects.\n'
'The "collections.abc" module provides a "MutableMapping" '
'abstract base\n'
@@ -7225,7 +7405,7 @@ topics = {'assert': 'The "assert" statement\n'
'the\n'
'"__contains__()" method to allow efficient use of the "in" '
'operator;\n'
- 'for mappings, "in" should search the mapping\'s keys; for '
+ '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'
@@ -7243,7 +7423,7 @@ topics = {'assert': 'The "assert" statement\n'
'Should return\n'
' the length of the object, an integer ">=" 0. Also, an '
'object that\n'
- ' doesn\'t define a "__bool__()" method and whose '
+ ' doesn’t define a "__bool__()" method and whose '
'"__len__()" method\n'
' returns zero is considered to be false in a Boolean '
'context.\n'
@@ -7311,12 +7491,6 @@ topics = {'assert': 'The "assert" statement\n'
'of the\n'
' sequence.\n'
'\n'
- 'object.__missing__(self, key)\n'
- '\n'
- ' Called by "dict"."__getitem__()" to implement '
- '"self[key]" for dict\n'
- ' subclasses when key is not in the dictionary.\n'
- '\n'
'object.__setitem__(self, key, value)\n'
'\n'
' Called to implement assignment to "self[key]". Same '
@@ -7344,6 +7518,12 @@ topics = {'assert': 'The "assert" statement\n'
' raised for improper *key* values as for the '
'"__getitem__()" method.\n'
'\n'
+ 'object.__missing__(self, key)\n'
+ '\n'
+ ' Called by "dict"."__getitem__()" to implement '
+ '"self[key]" for dict\n'
+ ' subclasses when key is not in the dictionary.\n'
+ '\n'
'object.__iter__(self)\n'
'\n'
' This method is called when an iterator is required for '
@@ -7400,7 +7580,7 @@ topics = {'assert': 'The "assert" statement\n'
'values or\n'
' the key-item pairs.\n'
'\n'
- ' For objects that don\'t define "__contains__()", the '
+ ' For objects that don’t define "__contains__()", the '
'membership test\n'
' first tries iteration via "__iter__()", then the old '
'sequence\n'
@@ -7413,7 +7593,7 @@ topics = {'assert': 'The "assert" statement\n'
'The shifting operations have lower priority than the arithmetic\n'
'operations:\n'
'\n'
- ' shift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n'
+ ' shift_expr ::= a_expr | shift_expr ("<<" | ">>") a_expr\n'
'\n'
'These operators accept integers as arguments. They shift the '
'first\n'
@@ -7488,7 +7668,7 @@ topics = {'assert': 'The "assert" statement\n'
'object.__dict__\n'
'\n'
' A dictionary or other mapping object used to store an '
- "object's\n"
+ 'object’s\n'
' (writable) attributes.\n'
'\n'
'instance.__class__\n'
@@ -7548,15 +7728,15 @@ topics = {'assert': 'The "assert" statement\n'
'to\n'
' "[1.0, 2.0]", and similarly for tuples.\n'
'\n'
- "[3] They must have since the parser can't tell the type of "
+ '[3] They must have since the parser can’t tell the type of '
'the\n'
' operands.\n'
'\n'
'[4] Cased characters are those with general category '
'property\n'
- ' being one of "Lu" (Letter, uppercase), "Ll" (Letter, '
+ ' being one of “Lu” (Letter, uppercase), “Ll” (Letter, '
'lowercase),\n'
- ' or "Lt" (Letter, titlecase).\n'
+ ' or “Lt” (Letter, titlecase).\n'
'\n'
'[5] To format only a tuple you should therefore provide a\n'
' singleton tuple whose only element is the tuple to be '
@@ -7568,7 +7748,7 @@ topics = {'assert': 'The "assert" statement\n'
'special\n'
'syntax (such as arithmetic operations or subscripting and '
'slicing) by\n'
- "defining methods with special names. This is Python's "
+ 'defining methods with special names. This is Python’s '
'approach to\n'
'*operator overloading*, allowing classes to define their own '
'behavior\n'
@@ -7602,7 +7782,7 @@ topics = {'assert': 'The "assert" statement\n'
'elements, but\n'
'extracting a slice may not make sense. (One example of this '
'is the\n'
- '"NodeList" interface in the W3C\'s Document Object Model.)\n'
+ '"NodeList" interface in the W3C’s Document Object Model.)\n'
'\n'
'\n'
'Basic customization\n'
@@ -7626,7 +7806,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Typical implementations create a new instance of the '
'class by\n'
- ' invoking the superclass\'s "__new__()" method using\n'
+ ' invoking the superclass’s "__new__()" method using\n'
' "super().__new__(cls[, ...])" with appropriate arguments '
'and then\n'
' modifying the newly-created instance as necessary before '
@@ -7635,7 +7815,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' If "__new__()" returns an instance of *cls*, then the '
'new\n'
- ' instance\'s "__init__()" method will be invoked like\n'
+ ' instance’s "__init__()" method will be invoked like\n'
' "__init__(self[, ...])", where *self* is the new instance '
'and the\n'
' remaining arguments are the same as were passed to '
@@ -7643,7 +7823,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' If "__new__()" does not return an instance of *cls*, then '
'the new\n'
- ' instance\'s "__init__()" method will not be invoked.\n'
+ ' instance’s "__init__()" method will not be invoked.\n'
'\n'
' "__new__()" is intended mainly to allow subclasses of '
'immutable\n'
@@ -7661,7 +7841,7 @@ topics = {'assert': 'The "assert" statement\n'
'those\n'
' passed to the class constructor expression. If a base '
'class has an\n'
- ' "__init__()" method, the derived class\'s "__init__()" '
+ ' "__init__()" method, the derived class’s "__init__()" '
'method, if\n'
' any, must explicitly call it to ensure proper '
'initialization of the\n'
@@ -7682,8 +7862,8 @@ topics = {'assert': 'The "assert" statement\n'
'is also\n'
' called a finalizer or (improperly) a destructor. If a '
'base class\n'
- ' has a "__del__()" method, the derived class\'s '
- '"__del__()" method,\n'
+ ' has a "__del__()" method, the derived class’s "__del__()" '
+ 'method,\n'
' if any, must explicitly call it to ensure proper deletion '
'of the\n'
' base class part of the instance.\n'
@@ -7703,11 +7883,11 @@ topics = {'assert': 'The "assert" statement\n'
'for\n'
' objects that still exist when the interpreter exits.\n'
'\n'
- ' Note: "del x" doesn\'t directly call "x.__del__()" --- '
- 'the former\n'
+ ' Note: "del x" doesn’t directly call "x.__del__()" — the '
+ 'former\n'
' decrements the reference count for "x" by one, and the '
'latter is\n'
- ' only called when "x"\'s reference count reaches zero.\n'
+ ' only called when "x"’s reference count reaches zero.\n'
'\n'
' **CPython implementation detail:** It is possible for a '
'reference\n'
@@ -7719,7 +7899,7 @@ topics = {'assert': 'The "assert" statement\n'
'reference\n'
' cycles is when an exception has been caught in a local '
'variable.\n'
- " The frame's locals then reference the exception, which "
+ ' The frame’s locals then reference the exception, which '
'references\n'
' its own traceback, which references the locals of all '
'frames caught\n'
@@ -7765,7 +7945,7 @@ topics = {'assert': 'The "assert" statement\n'
'object.__repr__(self)\n'
'\n'
' Called by the "repr()" built-in function to compute the '
- '"official"\n'
+ '“official”\n'
' string representation of an object. If at all possible, '
'this\n'
' should look like a valid Python expression that could be '
@@ -7779,7 +7959,7 @@ topics = {'assert': 'The "assert" statement\n'
' value must be a string object. If a class defines '
'"__repr__()" but\n'
' not "__str__()", then "__repr__()" is also used when an '
- '"informal"\n'
+ '“informal”\n'
' string representation of instances of that class is '
'required.\n'
'\n'
@@ -7791,7 +7971,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Called by "str(object)" and the built-in functions '
'"format()" and\n'
- ' "print()" to compute the "informal" or nicely printable '
+ ' "print()" to compute the “informal” or nicely printable '
'string\n'
' representation of an object. The return value must be a '
'string\n'
@@ -7819,7 +7999,7 @@ topics = {'assert': 'The "assert" statement\n'
'extension,\n'
' evaluation of formatted string literals and the '
'"str.format()"\n'
- ' method, to produce a "formatted" string representation of '
+ ' method, to produce a “formatted” string representation of '
'an\n'
' object. The "format_spec" argument is a string that '
'contains a\n'
@@ -7855,7 +8035,7 @@ topics = {'assert': 'The "assert" statement\n'
'object.__gt__(self, other)\n'
'object.__ge__(self, other)\n'
'\n'
- ' These are the so-called "rich comparison" methods. The\n'
+ ' These are the so-called “rich comparison” methods. The\n'
' correspondence between operator symbols and method names '
'is as\n'
' follows: "x<y" calls "x.__lt__(y)", "x<=y" calls '
@@ -7902,18 +8082,18 @@ topics = {'assert': 'The "assert" statement\n'
' when the left argument does not support the operation but '
'the right\n'
' argument does); rather, "__lt__()" and "__gt__()" are '
- "each other's\n"
- ' reflection, "__le__()" and "__ge__()" are each other\'s '
+ 'each other’s\n'
+ ' reflection, "__le__()" and "__ge__()" are each other’s '
'reflection,\n'
' and "__eq__()" and "__ne__()" are their own reflection. '
'If the\n'
- " operands are of different types, and right operand's type "
+ ' operands are of different types, and right operand’s type '
'is a\n'
- " direct or indirect subclass of the left operand's type, "
+ ' direct or indirect subclass of the left operand’s type, '
'the\n'
' reflected method of the right operand has priority, '
'otherwise the\n'
- " left operand's method has priority. Virtual subclassing "
+ ' left operand’s method has priority. Virtual subclassing '
'is not\n'
' considered.\n'
'\n'
@@ -7937,13 +8117,13 @@ topics = {'assert': 'The "assert" statement\n'
' return hash((self.name, self.nick, self.color))\n'
'\n'
' Note: "hash()" truncates the value returned from an '
- "object's\n"
+ 'object’s\n'
' custom "__hash__()" method to the size of a '
'"Py_ssize_t". This\n'
' is typically 8 bytes on 64-bit builds and 4 bytes on '
'32-bit\n'
- ' builds. If an object\'s "__hash__()" must '
- 'interoperate on builds\n'
+ ' builds. If an object’s "__hash__()" must interoperate '
+ 'on builds\n'
' of different bit sizes, be sure to check the width on '
'all\n'
' supported builds. An easy way to do this is with '
@@ -7961,8 +8141,8 @@ topics = {'assert': 'The "assert" statement\n'
' implements an "__eq__()" method, it should not implement\n'
' "__hash__()", since the implementation of hashable '
'collections\n'
- " requires that a key's hash value is immutable (if the "
- "object's hash\n"
+ ' requires that a key’s hash value is immutable (if the '
+ 'object’s hash\n'
' value changes, it will be in the wrong hash bucket).\n'
'\n'
' User-defined classes have "__eq__()" and "__hash__()" '
@@ -8006,7 +8186,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Note: By default, the "__hash__()" values of str, bytes '
'and\n'
- ' datetime objects are "salted" with an unpredictable '
+ ' datetime objects are “salted” with an unpredictable '
'random value.\n'
' Although they remain constant within an individual '
'Python\n'
@@ -8021,12 +8201,12 @@ topics = {'assert': 'The "assert" statement\n'
' See http://www.ocert.org/advisories/ocert-2011-003.html '
'for\n'
' details.Changing hash values affects the iteration '
- 'order of\n'
- ' dicts, sets and other mappings. Python has never made '
- 'guarantees\n'
- ' about this ordering (and it typically varies between '
- '32-bit and\n'
- ' 64-bit builds).See also "PYTHONHASHSEED".\n'
+ 'order of sets.\n'
+ ' Python has never made guarantees about this ordering '
+ '(and it\n'
+ ' typically varies between 32-bit and 64-bit builds).See '
+ 'also\n'
+ ' "PYTHONHASHSEED".\n'
'\n'
' Changed in version 3.3: Hash randomization is enabled by '
'default.\n'
@@ -8057,15 +8237,17 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'object.__getattr__(self, name)\n'
'\n'
- ' Called when an attribute lookup has not found the '
- 'attribute in the\n'
- ' usual places (i.e. it is not an instance attribute nor is '
- 'it found\n'
- ' in the class tree for "self"). "name" is the attribute '
- 'name. This\n'
- ' method should return the (computed) attribute value or '
- 'raise an\n'
- ' "AttributeError" exception.\n'
+ ' Called when the default attribute access fails with an\n'
+ ' "AttributeError" (either "__getattribute__()" raises an\n'
+ ' "AttributeError" because *name* is not an instance '
+ 'attribute or an\n'
+ ' attribute in the class tree for "self"; or "__get__()" of '
+ 'a *name*\n'
+ ' property raises "AttributeError"). This method should '
+ 'either\n'
+ ' return the (computed) attribute value or raise an '
+ '"AttributeError"\n'
+ ' exception.\n'
'\n'
' Note that if the attribute is found through the normal '
'mechanism,\n'
@@ -8188,17 +8370,17 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' def __setattr__(self, attr, value):\n'
" print(f'Setting {attr}...')\n"
- ' setattr(self, attr, value)\n'
+ ' super().__setattr__(attr, value)\n'
'\n'
' sys.modules[__name__].__class__ = VerboseModule\n'
'\n'
'Note: Defining module "__getattr__" and setting module '
'"__class__"\n'
' only affect lookups made using the attribute access syntax '
- '--\n'
+ '–\n'
' directly accessing the module globals (whether by code '
'within the\n'
- " module, or via a reference to the module's globals "
+ ' module, or via a reference to the module’s globals '
'dictionary) is\n'
' unaffected.\n'
'\n'
@@ -8222,13 +8404,13 @@ topics = {'assert': 'The "assert" statement\n'
'class\n'
'containing the method (a so-called *descriptor* class) '
'appears in an\n'
- "*owner* class (the descriptor must be in either the owner's "
+ '*owner* class (the descriptor must be in either the owner’s '
'class\n'
'dictionary or in the class dictionary for one of its '
'parents). In the\n'
- 'examples below, "the attribute" refers to the attribute '
+ '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__".\n'
'\n'
'object.__get__(self, instance, owner)\n'
'\n'
@@ -8285,8 +8467,8 @@ topics = {'assert': 'The "assert" statement\n'
'--------------------\n'
'\n'
'In general, a descriptor is an object attribute with '
- '"binding\n'
- 'behavior", one whose attribute access has been overridden by '
+ '“binding\n'
+ 'behavior”, one whose attribute access has been overridden by '
'methods\n'
'in the descriptor protocol: "__get__()", "__set__()", and\n'
'"__delete__()". If any of those methods are defined for an '
@@ -8295,7 +8477,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'The default behavior for attribute access is to get, set, or '
'delete\n'
- "the attribute from an object's dictionary. For instance, "
+ 'the attribute from an object’s dictionary. For instance, '
'"a.x" has a\n'
'lookup chain starting with "a.__dict__[\'x\']", then\n'
'"type(a).__dict__[\'x\']", and continuing through the base '
@@ -8349,7 +8531,7 @@ topics = {'assert': 'The "assert" statement\n'
'does not define "__get__()", then accessing the attribute '
'will return\n'
'the descriptor object itself unless there is a value in the '
- "object's\n"
+ 'object’s\n'
'instance dictionary. If the descriptor defines "__set__()" '
'and/or\n'
'"__delete__()", it is a data descriptor; if it defines '
@@ -8467,7 +8649,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'* Nonempty *__slots__* does not work for classes derived '
'from\n'
- ' "variable-length" built-in types such as "int", "bytes" '
+ ' “variable-length” built-in types such as "int", "bytes" '
'and "tuple".\n'
'\n'
'* Any non-string iterable may be assigned to *__slots__*. '
@@ -8500,7 +8682,7 @@ topics = {'assert': 'The "assert" statement\n'
'to class\n'
'decorators, but where class decorators only affect the '
'specific class\n'
- 'they\'re applied to, "__init_subclass__" solely applies to '
+ 'they’re applied to, "__init_subclass__" solely applies to '
'future\n'
'subclasses of the class defining the method.\n'
'\n'
@@ -8515,7 +8697,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Keyword arguments which are given to a new class are '
'passed to the\n'
- ' parent\'s class "__init_subclass__". For compatibility '
+ ' parent’s class "__init_subclass__". For compatibility '
'with other\n'
' classes using "__init_subclass__", one should take out '
'the needed\n'
@@ -8583,6 +8765,8 @@ topics = {'assert': 'The "assert" statement\n'
'When a class definition is executed, the following steps '
'occur:\n'
'\n'
+ '* MRO entries are resolved\n'
+ '\n'
'* the appropriate metaclass is determined\n'
'\n'
'* the class namespace is prepared\n'
@@ -8592,6 +8776,24 @@ topics = {'assert': 'The "assert" statement\n'
'* the class object is created\n'
'\n'
'\n'
+ 'Resolving MRO entries\n'
+ '---------------------\n'
+ '\n'
+ 'If a base that appears in class definition is not an '
+ 'instance of\n'
+ '"type", then an "__mro_entries__" method is searched on it. '
+ 'If found,\n'
+ 'it is called with the original bases tuple. This method must '
+ 'return a\n'
+ 'tuple of classes that will be used instead of this base. The '
+ 'tuple may\n'
+ 'be empty, in such case the original base is ignored.\n'
+ '\n'
+ 'See also: **PEP 560** - Core support for typing module and '
+ 'generic\n'
+ ' types\n'
+ '\n'
+ '\n'
'Determining the appropriate metaclass\n'
'-------------------------------------\n'
'\n'
@@ -8708,9 +8910,9 @@ topics = {'assert': 'The "assert" statement\n'
'up to the\n'
'"type.__new__" call in order for the class to be '
'initialised\n'
- 'correctly. Failing to do so will result in a '
- '"DeprecationWarning" in\n'
- 'Python 3.6, and a "RuntimeWarning" in the future.\n'
+ 'correctly. Failing to do so will result in a "RuntimeError" '
+ 'in Python\n'
+ '3.8.\n'
'\n'
'When using the default metaclass "type", or any metaclass '
'that\n'
@@ -8754,8 +8956,8 @@ topics = {'assert': 'The "assert" statement\n'
' Describes the implicit "__class__" closure reference\n'
'\n'
'\n'
- 'Metaclass example\n'
- '-----------------\n'
+ 'Uses for metaclasses\n'
+ '--------------------\n'
'\n'
'The potential uses for metaclasses are boundless. Some ideas '
'that have\n'
@@ -8765,48 +8967,6 @@ topics = {'assert': 'The "assert" statement\n'
'frameworks, and\n'
'automatic resource locking/synchronization.\n'
'\n'
- 'Here is an example of a metaclass that uses an\n'
- '"collections.OrderedDict" to remember the order that class '
- 'variables\n'
- 'are defined:\n'
- '\n'
- ' class OrderedClass(type):\n'
- '\n'
- ' @classmethod\n'
- ' def __prepare__(metacls, name, bases, **kwds):\n'
- ' return collections.OrderedDict()\n'
- '\n'
- ' def __new__(cls, name, bases, namespace, **kwds):\n'
- ' result = type.__new__(cls, name, bases, '
- 'dict(namespace))\n'
- ' result.members = tuple(namespace)\n'
- ' return result\n'
- '\n'
- ' class A(metaclass=OrderedClass):\n'
- ' def one(self): pass\n'
- ' def two(self): pass\n'
- ' def three(self): pass\n'
- ' def four(self): pass\n'
- '\n'
- ' >>> A.members\n'
- " ('__module__', 'one', 'two', 'three', 'four')\n"
- '\n'
- 'When the class definition for *A* gets executed, the process '
- 'begins\n'
- 'with calling the metaclass\'s "__prepare__()" method which '
- 'returns an\n'
- 'empty "collections.OrderedDict". That mapping records the '
- 'methods and\n'
- 'attributes of *A* as they are defined within the body of the '
- 'class\n'
- 'statement. Once those definitions are executed, the ordered '
- 'dictionary\n'
- 'is fully populated and the metaclass\'s "__new__()" method '
- 'gets\n'
- 'invoked. That method builds the new type and it saves the '
- 'ordered\n'
- 'dictionary keys in an attribute called "members".\n'
- '\n'
'\n'
'Customizing instance and subclass checks\n'
'========================================\n'
@@ -8819,7 +8979,7 @@ topics = {'assert': 'The "assert" statement\n'
'methods in\n'
'order to allow the addition of Abstract Base Classes (ABCs) '
'as\n'
- '"virtual base classes" to any class or type (including '
+ '“virtual base classes” to any class or type (including '
'built-in\n'
'types), including other ABCs.\n'
'\n'
@@ -8862,12 +9022,38 @@ topics = {'assert': 'The "assert" statement\n'
' module) to the language.\n'
'\n'
'\n'
+ 'Emulating generic types\n'
+ '=======================\n'
+ '\n'
+ 'One can implement the generic class syntax as specified by '
+ '**PEP 484**\n'
+ '(for example "List[int]") by defining a special method\n'
+ '\n'
+ 'classmethod object.__class_getitem__(cls, key)\n'
+ '\n'
+ ' Return an object representing the specialization of a '
+ 'generic class\n'
+ ' by type arguments found in *key*.\n'
+ '\n'
+ 'This method is looked up on the class object itself, and '
+ 'when defined\n'
+ 'in the class body, this method is implicitly a class '
+ 'method. Note,\n'
+ 'this mechanism is primarily reserved for use with static '
+ 'type hints,\n'
+ 'other usage is discouraged.\n'
+ '\n'
+ 'See also: **PEP 560** - Core support for typing module and '
+ 'generic\n'
+ ' types\n'
+ '\n'
+ '\n'
'Emulating callable objects\n'
'==========================\n'
'\n'
'object.__call__(self[, args...])\n'
'\n'
- ' Called when the instance is "called" as a function; if '
+ ' Called when the instance is “called” as a function; if '
'this method\n'
' is defined, "x(arg1, arg2, ...)" is a shorthand for\n'
' "x.__call__(arg1, arg2, ...)".\n'
@@ -8896,7 +9082,7 @@ topics = {'assert': 'The "assert" statement\n'
'"clear()",\n'
'"setdefault()", "pop()", "popitem()", "copy()", and '
'"update()"\n'
- "behaving similar to those for Python's standard dictionary "
+ 'behaving similar to those for Python’s standard dictionary '
'objects.\n'
'The "collections.abc" module provides a "MutableMapping" '
'abstract base\n'
@@ -8921,7 +9107,7 @@ topics = {'assert': 'The "assert" statement\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 '
+ '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'
@@ -8939,7 +9125,7 @@ topics = {'assert': 'The "assert" statement\n'
'Should return\n'
' the length of the object, an integer ">=" 0. Also, an '
'object that\n'
- ' doesn\'t define a "__bool__()" method and whose '
+ ' doesn’t define a "__bool__()" method and whose '
'"__len__()" method\n'
' returns zero is considered to be false in a Boolean '
'context.\n'
@@ -9006,12 +9192,6 @@ topics = {'assert': 'The "assert" statement\n'
'the\n'
' sequence.\n'
'\n'
- 'object.__missing__(self, key)\n'
- '\n'
- ' Called by "dict"."__getitem__()" to implement "self[key]" '
- 'for dict\n'
- ' subclasses when key is not in the dictionary.\n'
- '\n'
'object.__setitem__(self, key, value)\n'
'\n'
' Called to implement assignment to "self[key]". Same note '
@@ -9039,6 +9219,12 @@ topics = {'assert': 'The "assert" statement\n'
' raised for improper *key* values as for the '
'"__getitem__()" method.\n'
'\n'
+ 'object.__missing__(self, key)\n'
+ '\n'
+ ' Called by "dict"."__getitem__()" to implement "self[key]" '
+ 'for dict\n'
+ ' subclasses when key is not in the dictionary.\n'
+ '\n'
'object.__iter__(self)\n'
'\n'
' This method is called when an iterator is required for a '
@@ -9095,7 +9281,7 @@ topics = {'assert': 'The "assert" statement\n'
'values or\n'
' the key-item pairs.\n'
'\n'
- ' For objects that don\'t define "__contains__()", the '
+ ' For objects that don’t define "__contains__()", the '
'membership test\n'
' first tries iteration via "__iter__()", then the old '
'sequence\n'
@@ -9191,15 +9377,15 @@ topics = {'assert': 'The "assert" statement\n'
'"__rpow__()" (the\n'
' coercion rules would become too complicated).\n'
'\n'
- " Note: If the right operand's type is a subclass of the "
+ ' Note: If the right operand’s type is a subclass of the '
'left\n'
- " operand's type and that subclass provides the reflected "
+ ' operand’s type and that subclass provides the reflected '
'method\n'
' for the operation, this method will be called before '
'the left\n'
- " operand's non-reflected method. This behavior allows "
+ ' operand’s non-reflected method. This behavior allows '
'subclasses\n'
- " to override their ancestors' operations.\n"
+ ' to override their ancestors’ operations.\n'
'\n'
'object.__iadd__(self, other)\n'
'object.__isub__(self, other)\n'
@@ -9237,7 +9423,7 @@ topics = {'assert': 'The "assert" statement\n'
'certain\n'
' situations, augmented assignment can result in unexpected '
'errors\n'
- " (see Why does a_tuple[i] += ['item'] raise an exception "
+ ' (see Why does a_tuple[i] += [‘item’] raise an exception '
'when the\n'
' addition works?), but this behavior is in fact part of '
'the data\n'
@@ -9255,13 +9441,11 @@ topics = {'assert': 'The "assert" statement\n'
'object.__complex__(self)\n'
'object.__int__(self)\n'
'object.__float__(self)\n'
- 'object.__round__(self[, n])\n'
'\n'
' Called to implement the built-in functions "complex()", '
- '"int()",\n'
- ' "float()" and "round()". Should return a value of the '
- 'appropriate\n'
- ' type.\n'
+ '"int()" and\n'
+ ' "float()". Should return a value of the appropriate '
+ 'type.\n'
'\n'
'object.__index__(self)\n'
'\n'
@@ -9281,6 +9465,24 @@ topics = {'assert': 'The "assert" statement\n'
'defined, and\n'
' both should return the same value.\n'
'\n'
+ 'object.__round__(self[, ndigits])\n'
+ 'object.__trunc__(self)\n'
+ 'object.__floor__(self)\n'
+ 'object.__ceil__(self)\n'
+ '\n'
+ ' Called to implement the built-in function "round()" and '
+ '"math"\n'
+ ' functions "trunc()", "floor()" and "ceil()". Unless '
+ '*ndigits* is\n'
+ ' passed to "__round__()" all these methods should return '
+ 'the value\n'
+ ' of the object truncated to an "Integral" (typically an '
+ '"int").\n'
+ '\n'
+ ' If "__int__()" is not defined then the built-in function '
+ '"int()"\n'
+ ' falls back to "__trunc__()".\n'
+ '\n'
'\n'
'With Statement Context Managers\n'
'===============================\n'
@@ -9311,7 +9513,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Enter the runtime context related to this object. The '
'"with"\n'
- " statement will bind this method's return value to the "
+ ' statement will bind this method’s return value to the '
'target(s)\n'
' specified in the "as" clause of the statement, if any.\n'
'\n'
@@ -9335,11 +9537,11 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Note that "__exit__()" methods should not reraise the '
'passed-in\n'
- " exception; this is the caller's responsibility.\n"
+ ' exception; this is the caller’s responsibility.\n'
'\n'
'See also:\n'
'\n'
- ' **PEP 343** - The "with" statement\n'
+ ' **PEP 343** - The “with” statement\n'
' The specification, background, and examples for the '
'Python "with"\n'
' statement.\n'
@@ -9350,9 +9552,9 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'For custom classes, implicit invocations of special methods '
'are only\n'
- "guaranteed to work correctly if defined on an object's type, "
+ 'guaranteed to work correctly if defined on an object’s type, '
'not in\n'
- "the object's instance dictionary. That behaviour is the "
+ 'the object’s instance dictionary. That behaviour is the '
'reason why\n'
'the following code raises an exception:\n'
'\n'
@@ -9386,7 +9588,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'Incorrectly attempting to invoke an unbound method of a '
'class in this\n'
- "way is sometimes referred to as 'metaclass confusion', and "
+ 'way is sometimes referred to as ‘metaclass confusion’, and '
'is avoided\n'
'by bypassing the instance when looking up special methods:\n'
'\n'
@@ -9399,7 +9601,7 @@ topics = {'assert': 'The "assert" statement\n'
'interest of\n'
'correctness, implicit special method lookup generally also '
'bypasses\n'
- 'the "__getattribute__()" method even of the object\'s '
+ 'the "__getattribute__()" method even of the object’s '
'metaclass:\n'
'\n'
' >>> class Meta(type):\n'
@@ -9615,20 +9817,21 @@ topics = {'assert': 'The "assert" statement\n'
' formatting options that can be specified in format '
'strings.\n'
'\n'
- ' Note: When formatting a number ("int", "float", "float" '
- 'and\n'
- ' subclasses) with the "n" type (ex: '
- '"\'{:n}\'.format(1234)"), the\n'
- ' function sets temporarily the "LC_CTYPE" locale to '
- 'the\n'
- ' "LC_NUMERIC" locale to decode "decimal_point" and '
- '"thousands_sep"\n'
- ' fields of "localeconv()" if they are non-ASCII or '
- 'longer than 1\n'
- ' byte, and the "LC_NUMERIC" locale is different than '
- 'the\n'
- ' "LC_CTYPE" locale. This temporary change affects '
- 'other threads.\n'
+ ' Note: When formatting a number ("int", "float", '
+ '"complex",\n'
+ ' "decimal.Decimal" and subclasses) with the "n" type '
+ '(ex:\n'
+ ' "\'{:n}\'.format(1234)"), the function temporarily '
+ 'sets the\n'
+ ' "LC_CTYPE" locale to the "LC_NUMERIC" locale to '
+ 'decode\n'
+ ' "decimal_point" and "thousands_sep" fields of '
+ '"localeconv()" if\n'
+ ' they are non-ASCII or longer than 1 byte, and the '
+ '"LC_NUMERIC"\n'
+ ' locale is different than the "LC_CTYPE" locale. This '
+ 'temporary\n'
+ ' change affects other threads.\n'
'\n'
' Changed in version 3.7: When formatting a number with '
'the "n" type,\n'
@@ -9679,11 +9882,11 @@ topics = {'assert': 'The "assert" statement\n'
'Alphabetic\n'
' characters are those characters defined in the Unicode '
'character\n'
- ' database as "Letter", i.e., those with general category '
+ ' database as “Letter”, i.e., those with general category '
'property\n'
- ' being one of "Lm", "Lt", "Lu", "Ll", or "Lo". Note '
+ ' being one of “Lm”, “Lt”, “Lu”, “Ll”, or “Lo”. Note '
'that this is\n'
- ' different from the "Alphabetic" property defined in the '
+ ' different from the “Alphabetic” property defined in the '
'Unicode\n'
' Standard.\n'
'\n'
@@ -9707,7 +9910,7 @@ topics = {'assert': 'The "assert" statement\n'
'in base 10,\n'
' e.g. U+0660, ARABIC-INDIC DIGIT ZERO. Formally a '
'decimal character\n'
- ' is a character in the Unicode General Category "Nd".\n'
+ ' is a character in the Unicode General Category “Nd”.\n'
'\n'
'str.isdigit()\n'
'\n'
@@ -9731,9 +9934,18 @@ topics = {'assert': 'The "assert" statement\n'
'according to the\n'
' language definition, section Identifiers and keywords.\n'
'\n'
- ' Use "keyword.iskeyword()" to test for reserved '
- 'identifiers such as\n'
- ' "def" and "class".\n'
+ ' Call "keyword.iskeyword()" to test whether string "s" '
+ 'is a reserved\n'
+ ' identifier, such as "def" and "class".\n'
+ '\n'
+ ' Example:\n'
+ '\n'
+ ' >>> from keyword import iskeyword\n'
+ '\n'
+ " >>> 'hello'.isidentifier(), iskeyword('hello')\n"
+ ' True, False\n'
+ " >>> 'def'.isidentifier(), iskeyword('def')\n"
+ ' True, True\n'
'\n'
'str.islower()\n'
'\n'
@@ -9766,7 +9978,7 @@ topics = {'assert': 'The "assert" statement\n'
'characters are\n'
' those characters defined in the Unicode character '
'database as\n'
- ' "Other" or "Separator", excepting the ASCII space '
+ ' “Other” or “Separator”, excepting the ASCII space '
'(0x20) which is\n'
' considered printable. (Note that printable characters '
'in this\n'
@@ -9784,9 +9996,9 @@ topics = {'assert': 'The "assert" statement\n'
'Whitespace\n'
' characters are those characters defined in the Unicode '
'character\n'
- ' database as "Other" or "Separator" and those with '
+ ' database as “Other” or “Separator” and those with '
'bidirectional\n'
- ' property being one of "WS", "B", or "S".\n'
+ ' property being one of “WS”, “B”, or “S”.\n'
'\n'
'str.istitle()\n'
'\n'
@@ -10241,12 +10453,12 @@ topics = {'assert': 'The "assert" statement\n'
' Return a copy of the string with all the cased '
'characters [4]\n'
' converted to uppercase. Note that '
- '"str.upper().isupper()" might be\n'
+ '"s.upper().isupper()" might be\n'
' "False" if "s" contains uncased characters or if the '
'Unicode\n'
- ' category of the resulting character(s) is not "Lu" '
+ ' category of the resulting character(s) is not “Lu” '
'(Letter,\n'
- ' uppercase), but e.g. "Lt" (Letter, titlecase).\n'
+ ' uppercase), but e.g. “Lt” (Letter, titlecase).\n'
'\n'
' The uppercasing algorithm used is described in section '
'3.13 of the\n'
@@ -10341,9 +10553,9 @@ topics = {'assert': 'The "assert" statement\n'
'literals,\n'
'"\'\\U\'" and "\'\\u\'" escapes in raw strings are not treated '
'specially.\n'
- "Given that Python 2.x's raw unicode literals behave differently "
+ 'Given that Python 2.x’s raw unicode literals behave differently '
'than\n'
- 'Python 3.x\'s the "\'ur\'" syntax is not supported.\n'
+ 'Python 3.x’s the "\'ur\'" syntax is not supported.\n'
'\n'
'New in version 3.3: The "\'rb\'" prefix of raw bytes literals has '
'been\n'
@@ -10367,7 +10579,7 @@ topics = {'assert': 'The "assert" statement\n'
'In triple-quoted literals, unescaped newlines and quotes are '
'allowed\n'
'(and are retained), except that three unescaped quotes in a row\n'
- 'terminate the literal. (A "quote" is the character used to open '
+ 'terminate the literal. (A “quote” is the character used to open '
'the\n'
'literal, i.e. either "\'" or """.)\n'
'\n'
@@ -10477,9 +10689,13 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Changed in version 3.6: Unrecognized escape sequences produce '
'a\n'
- ' DeprecationWarning. In some future version of Python they '
- 'will be\n'
- ' a SyntaxError.\n'
+ ' "DeprecationWarning".\n'
+ '\n'
+ ' Changed in version 3.8: Unrecognized escape sequences produce '
+ 'a\n'
+ ' "SyntaxWarning". In some future version of Python they will '
+ 'be a\n'
+ ' "SyntaxError".\n'
'\n'
'Even in a raw literal, quotes can be escaped with a backslash, '
'but the\n'
@@ -10527,9 +10743,9 @@ topics = {'assert': 'The "assert" statement\n'
'exactly one\n'
'item.)\n'
'\n'
- 'If the primary is a sequence, the expression (list) must '
- 'evaluate to\n'
- 'an integer or a slice (as discussed in the following '
+ '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'
'\n'
'The formal syntax makes no special provision for negative '
@@ -10546,13 +10762,13 @@ topics = {'assert': 'The "assert" statement\n'
'item whose\n'
'index is that value (counting from zero). Since the support '
'for\n'
- "negative indices and slicing occurs in the object's "
+ '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'
'\n'
- "A string's items are characters. A character is not a "
+ 'A string’s items are characters. A character is not a '
'separate data\n'
'type but a string of exactly one character.\n',
'truth': 'Truth Value Testing\n'
@@ -10609,7 +10825,7 @@ topics = {'assert': 'The "assert" statement\n'
'less except clause, if present, must be last; it matches any\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'
+ 'object is “compatible” with the exception. An object is compatible\n'
'with an exception if it is the class or a base class of the '
'exception\n'
'object or a tuple containing an item compatible with the exception.\n'
@@ -10631,7 +10847,7 @@ topics = {'assert': 'The "assert" statement\n'
'When a matching except clause is found, the exception is assigned to\n'
'the target specified after the "as" keyword in that except clause, '
'if\n'
- "present, and the except clause's suite is executed. All except\n"
+ 'present, and the except clause’s suite is executed. All except\n'
'clauses must have an executable block. When the end of this block '
'is\n'
'reached, execution continues normally after the entire try '
@@ -10661,7 +10877,7 @@ topics = {'assert': 'The "assert" statement\n'
'cycle with the stack frame, keeping all locals in that frame alive\n'
'until the next garbage collection occurs.\n'
'\n'
- "Before an except clause's suite is executed, details about the\n"
+ 'Before an except clause’s suite is executed, details about the\n'
'exception are stored in the "sys" module and can be accessed via\n'
'"sys.exc_info()". "sys.exc_info()" returns a 3-tuple consisting of '
'the\n'
@@ -10671,11 +10887,14 @@ topics = {'assert': 'The "assert" statement\n'
'restored to their previous values (before the call) when returning\n'
'from a function that handled an exception.\n'
'\n'
- 'The optional "else" clause is executed if and when control flows off\n'
- 'the end of the "try" clause. [2] Exceptions in the "else" clause are\n'
+ 'The optional "else" clause is executed if the control flow leaves '
+ 'the\n'
+ '"try" suite, no exception was raised, and no "return", "continue", '
+ 'or\n'
+ '"break" statement was executed. Exceptions in the "else" clause are\n'
'not handled by the preceding "except" clauses.\n'
'\n'
- 'If "finally" is present, it specifies a \'cleanup\' handler. The '
+ 'If "finally" is present, it specifies a ‘cleanup’ handler. The '
'"try"\n'
'clause is executed, including any "except" and "else" clauses. If '
'an\n'
@@ -10687,8 +10906,9 @@ topics = {'assert': 'The "assert" statement\n'
'clause. If the "finally" clause raises another exception, the saved\n'
'exception is set as the context of the new exception. If the '
'"finally"\n'
- 'clause executes a "return" or "break" statement, the saved exception\n'
- 'is discarded:\n'
+ 'clause executes a "return", "break" or "continue" statement, the '
+ 'saved\n'
+ 'exception is discarded:\n'
'\n'
' >>> def f():\n'
' ... try:\n'
@@ -10703,12 +10923,8 @@ topics = {'assert': 'The "assert" statement\n'
'execution of the "finally" clause.\n'
'\n'
'When a "return", "break" or "continue" statement is executed in the\n'
- '"try" suite of a "try"..."finally" statement, the "finally" clause '
- 'is\n'
- 'also executed \'on the way out.\' A "continue" statement is illegal '
- 'in\n'
- 'the "finally" clause. (The reason is a problem with the current\n'
- 'implementation --- this restriction may be lifted in the future).\n'
+ '"try" suite of a "try"…"finally" statement, the "finally" clause is\n'
+ 'also executed ‘on the way out.’\n'
'\n'
'The return value of a function is determined by the last "return"\n'
'statement executed. Since the "finally" clause always executes, a\n'
@@ -10728,7 +10944,11 @@ topics = {'assert': 'The "assert" statement\n'
'Additional information on exceptions can be found in section\n'
'Exceptions, and information on using the "raise" statement to '
'generate\n'
- 'exceptions may be found in section The raise statement.\n',
+ 'exceptions may be found in section The raise statement.\n'
+ '\n'
+ 'Changed in version 3.8: Prior to Python 3.8, a "continue" statement\n'
+ 'was illegal in the "finally" clause due to a problem with the\n'
+ 'implementation.\n',
'types': 'The standard type hierarchy\n'
'***************************\n'
'\n'
@@ -10743,7 +10963,7 @@ topics = {'assert': 'The "assert" statement\n'
'will often be provided via the standard library instead.\n'
'\n'
'Some of the type descriptions below contain a paragraph listing\n'
- "'special attributes.' These are attributes that provide access to "
+ '‘special attributes.’ These are attributes that provide access to '
'the\n'
'implementation and are not intended for general use. Their '
'definition\n'
@@ -10756,7 +10976,7 @@ topics = {'assert': 'The "assert" statement\n'
'It\n'
' is used to signify the absence of a value in many situations, '
'e.g.,\n'
- " it is returned from functions that don't explicitly return\n"
+ ' it is returned from functions that don’t explicitly return\n'
' anything. Its truth value is false.\n'
'\n'
'NotImplemented\n'
@@ -10807,7 +11027,7 @@ topics = {'assert': 'The "assert" statement\n'
'shift\n'
' and mask operations, a binary representation is assumed, '
'and\n'
- " negative numbers are represented in a variant of 2's\n"
+ ' negative numbers are represented in a variant of 2’s\n'
' complement which gives the illusion of an infinite string '
'of\n'
' sign bits extending to the left.\n'
@@ -10861,7 +11081,7 @@ topics = {'assert': 'The "assert" statement\n'
'items\n'
' of a sequence. When the length of a sequence is *n*, the index '
'set\n'
- ' contains the numbers 0, 1, ..., *n*-1. Item *i* of sequence *a* '
+ ' contains the numbers 0, 1, …, *n*-1. Item *i* of sequence *a* '
'is\n'
' selected by "a[i]".\n'
'\n'
@@ -10871,8 +11091,8 @@ topics = {'assert': 'The "assert" statement\n'
'implies\n'
' that the index set is renumbered so that it starts at 0.\n'
'\n'
- ' Some sequences also support "extended slicing" with a third '
- '"step"\n'
+ ' Some sequences also support “extended slicing” with a third '
+ '“step”\n'
' parameter: "a[i:j:k]" selects all items of *a* with index *x* '
'where\n'
' "x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n'
@@ -10897,7 +11117,7 @@ topics = {'assert': 'The "assert" statement\n'
'code\n'
' points. All the code points in the range "U+0000 - '
'U+10FFFF"\n'
- " can be represented in a string. Python doesn't have a "
+ ' can be represented in a string. Python doesn’t have a '
'"char"\n'
' type; instead, every code point in the string is '
'represented\n'
@@ -10916,7 +11136,7 @@ topics = {'assert': 'The "assert" statement\n'
' The items of a tuple are arbitrary Python objects. Tuples '
'of\n'
' two or more items are formed by comma-separated lists of\n'
- " expressions. A tuple of one item (a 'singleton') can be\n"
+ ' expressions. A tuple of one item (a ‘singleton’) can be\n'
' formed by affixing a comma to an expression (an expression '
'by\n'
' itself does not create a tuple, since parentheses must be\n'
@@ -11022,7 +11242,7 @@ topics = {'assert': 'The "assert" statement\n'
'object\n'
' identity, the reason being that the efficient implementation '
'of\n'
- " dictionaries requires a key's hash value to remain constant.\n"
+ ' dictionaries requires a key’s hash value to remain constant.\n'
' Numeric types used for keys obey the normal rules for '
'numeric\n'
' comparison: if two numbers compare equal (e.g., "1" and '
@@ -11047,7 +11267,7 @@ topics = {'assert': 'The "assert" statement\n'
' definition (see section Function definitions). It should be\n'
' called with an argument list containing the same number of '
'items\n'
- " as the function's formal parameter list.\n"
+ ' as the function’s formal parameter list.\n'
'\n'
' Special attributes:\n'
'\n'
@@ -11057,8 +11277,8 @@ topics = {'assert': 'The "assert" statement\n'
'| |\n'
' '
'+===========================+=================================+=============+\n'
- ' | "__doc__" | The function\'s '
- 'documentation | Writable |\n'
+ ' | "__doc__" | The function’s documentation '
+ '| Writable |\n'
' | | string, or "None" if '
'| |\n'
' | | unavailable; not inherited by '
@@ -11067,12 +11287,12 @@ topics = {'assert': 'The "assert" statement\n'
'| |\n'
' '
'+---------------------------+---------------------------------+-------------+\n'
- ' | "__name__" | The function\'s '
- 'name | Writable |\n'
+ ' | "__name__" | The function’s name '
+ '| Writable |\n'
' '
'+---------------------------+---------------------------------+-------------+\n'
- ' | "__qualname__" | The function\'s *qualified '
- 'name* | Writable |\n'
+ ' | "__qualname__" | The function’s *qualified name* '
+ '| Writable |\n'
' | | New in version 3.3. '
'| |\n'
' '
@@ -11105,9 +11325,9 @@ topics = {'assert': 'The "assert" statement\n'
'+---------------------------+---------------------------------+-------------+\n'
' | "__globals__" | A reference to the dictionary '
'| Read-only |\n'
- " | | that holds the function's "
+ ' | | that holds the function’s '
'| |\n'
- ' | | global variables --- the global '
+ ' | | global variables — the global '
'| |\n'
' | | namespace of the module in '
'| |\n'
@@ -11125,7 +11345,7 @@ topics = {'assert': 'The "assert" statement\n'
'| Read-only |\n'
' | | contain bindings for the '
'| |\n'
- " | | function's free variables. See "
+ ' | | function’s free variables. See '
'| |\n'
' | | below for information on the '
'| |\n'
@@ -11152,7 +11372,7 @@ topics = {'assert': 'The "assert" statement\n'
' '
'+---------------------------+---------------------------------+-------------+\n'
'\n'
- ' Most of the attributes labelled "Writable" check the type of '
+ ' Most of the attributes labelled “Writable” check the type of '
'the\n'
' assigned value.\n'
'\n'
@@ -11171,7 +11391,7 @@ topics = {'assert': 'The "assert" statement\n'
' A cell object has the attribute "cell_contents". This can be\n'
' used to get the value of the cell, as well as set the value.\n'
'\n'
- " Additional information about a function's definition can be\n"
+ ' Additional information about a function’s definition can be\n'
' retrieved from its code object; see the description of '
'internal\n'
' types below.\n'
@@ -11184,7 +11404,7 @@ topics = {'assert': 'The "assert" statement\n'
' Special read-only attributes: "__self__" is the class '
'instance\n'
' object, "__func__" is the function object; "__doc__" is the\n'
- ' method\'s documentation (same as "__func__.__doc__"); '
+ ' method’s documentation (same as "__func__.__doc__"); '
'"__name__"\n'
' is the method name (same as "__func__.__name__"); '
'"__module__"\n'
@@ -11208,7 +11428,7 @@ topics = {'assert': 'The "assert" statement\n'
'instances,\n'
' its "__self__" attribute is the instance, and the method '
'object\n'
- ' is said to be bound. The new method\'s "__func__" attribute '
+ ' is said to be bound. The new method’s "__func__" attribute '
'is\n'
' the original function object.\n'
'\n'
@@ -11241,7 +11461,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' When an instance method object is derived from a class '
'method\n'
- ' object, the "class instance" stored in "__self__" will '
+ ' object, the “class instance” stored in "__self__" will '
'actually\n'
' be the class itself, so that calling either "x.f(1)" or '
'"C.f(1)"\n'
@@ -11274,7 +11494,7 @@ topics = {'assert': 'The "assert" statement\n'
'object\n'
' which can be used to execute the body of the function: '
'calling\n'
- ' the iterator\'s "iterator.__next__()" method will cause the\n'
+ ' the iterator’s "iterator.__next__()" method will cause the\n'
' function to execute until it provides a value using the '
'"yield"\n'
' statement. When the function executes a "return" statement '
@@ -11303,7 +11523,7 @@ topics = {'assert': 'The "assert" statement\n'
'for"\n'
' statement to execute the body of the function.\n'
'\n'
- ' Calling the asynchronous iterator\'s "aiterator.__anext__()"\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'
@@ -11322,9 +11542,9 @@ topics = {'assert': 'The "assert" statement\n'
'of\n'
' the arguments are determined by the C function. Special '
'read-\n'
- ' only attributes: "__doc__" is the function\'s documentation\n'
+ ' only attributes: "__doc__" is the function’s documentation\n'
' string, or "None" if unavailable; "__name__" is the '
- "function's\n"
+ 'function’s\n'
' name; "__self__" is set to "None" (but see the next item);\n'
' "__module__" is the name of the module the function was '
'defined\n'
@@ -11357,7 +11577,7 @@ topics = {'assert': 'The "assert" statement\n'
'Modules\n'
' Modules are a basic organizational unit of Python code, and are\n'
' created by the import system as invoked either by the "import"\n'
- ' statement (see "import"), or by calling functions such as\n'
+ ' statement, or by calling functions such as\n'
' "importlib.import_module()" and built-in "__import__()". A '
'module\n'
' object has a namespace implemented by a dictionary object (this '
@@ -11367,16 +11587,16 @@ topics = {'assert': 'The "assert" statement\n'
' translated to lookups in this dictionary, e.g., "m.x" is '
'equivalent\n'
' to "m.__dict__["x"]". A module object does not contain the code\n'
- " object used to initialize the module (since it isn't needed "
+ ' object used to initialize the module (since it isn’t needed '
'once\n'
' the initialization is done).\n'
'\n'
- " Attribute assignment updates the module's namespace dictionary,\n"
+ ' Attribute assignment updates the module’s namespace dictionary,\n'
' e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n'
'\n'
- ' Predefined (writable) attributes: "__name__" is the module\'s '
+ ' Predefined (writable) attributes: "__name__" is the module’s '
'name;\n'
- ' "__doc__" is the module\'s documentation string, or "None" if\n'
+ ' "__doc__" is the module’s documentation string, or "None" if\n'
' unavailable; "__annotations__" (optional) is a dictionary\n'
' containing *variable annotations* collected during module body\n'
' execution; "__file__" is the pathname of the file from which '
@@ -11389,7 +11609,7 @@ topics = {'assert': 'The "assert" statement\n'
'is\n'
' the pathname of the shared library file.\n'
'\n'
- ' Special read-only attribute: "__dict__" is the module\'s '
+ ' Special read-only attribute: "__dict__" is the module’s '
'namespace\n'
' as a dictionary object.\n'
'\n'
@@ -11418,7 +11638,7 @@ topics = {'assert': 'The "assert" statement\n'
' classes. This search of the base classes uses the C3 method\n'
' resolution order which behaves correctly even in the presence '
'of\n'
- " 'diamond' inheritance structures where there are multiple\n"
+ ' ‘diamond’ inheritance structures where there are multiple\n'
' inheritance paths leading back to a common ancestor. Additional\n'
' details on the C3 MRO used by Python can be found in the\n'
' documentation accompanying the 2.3 release at\n'
@@ -11427,7 +11647,7 @@ topics = {'assert': 'The "assert" statement\n'
' When a class attribute reference (for class "C", say) would '
'yield a\n'
' class method object, it is transformed into an instance method\n'
- ' object whose "__self__" attributes is "C". When it would yield '
+ ' object whose "__self__" attribute is "C". When it would yield '
'a\n'
' static method object, it is transformed into the object wrapped '
'by\n'
@@ -11437,7 +11657,7 @@ topics = {'assert': 'The "assert" statement\n'
'differ\n'
' from those actually contained in its "__dict__".\n'
'\n'
- " Class attribute assignments update the class's dictionary, "
+ ' Class attribute assignments update the class’s dictionary, '
'never\n'
' the dictionary of a base class.\n'
'\n'
@@ -11449,11 +11669,11 @@ topics = {'assert': 'The "assert" statement\n'
'is\n'
' the module name in which the class was defined; "__dict__" is '
'the\n'
- ' dictionary containing the class\'s namespace; "__bases__" is a '
+ ' dictionary containing the class’s namespace; "__bases__" is a '
'tuple\n'
' containing the base classes, in the order of their occurrence '
'in\n'
- ' the base class list; "__doc__" is the class\'s documentation '
+ ' the base class list; "__doc__" is the class’s documentation '
'string,\n'
' or "None" if undefined; "__annotations__" (optional) is a\n'
' dictionary containing *variable annotations* collected during '
@@ -11466,7 +11686,7 @@ topics = {'assert': 'The "assert" statement\n'
' A class instance has a namespace implemented as a dictionary '
'which\n'
' is the first place in which attribute references are searched.\n'
- " When an attribute is not found there, and the instance's class "
+ ' When an attribute is not found there, and the instance’s class '
'has\n'
' an attribute by that name, the search continues with the class\n'
' attributes. If a class attribute is found that is a '
@@ -11475,17 +11695,17 @@ topics = {'assert': 'The "assert" statement\n'
'object\n'
' whose "__self__" attribute is the instance. Static method and\n'
' class method objects are also transformed; see above under\n'
- ' "Classes". See section Implementing Descriptors for another way '
+ ' “Classes”. See section Implementing Descriptors for another way '
'in\n'
' which attributes of a class retrieved via its instances may '
'differ\n'
- ' from the objects actually stored in the class\'s "__dict__". If '
+ ' from the objects actually stored in the class’s "__dict__". If '
'no\n'
- " class attribute is found, and the object's class has a\n"
+ ' class attribute is found, and the object’s class has a\n'
' "__getattr__()" method, that is called to satisfy the lookup.\n'
'\n'
- " Attribute assignments and deletions update the instance's\n"
- " dictionary, never a class's dictionary. If the class has a\n"
+ ' Attribute assignments and deletions update the instance’s\n'
+ ' dictionary, never a class’s dictionary. If the class has a\n'
' "__setattr__()" or "__delattr__()" method, this is called '
'instead\n'
' of updating the instance dictionary directly.\n'
@@ -11496,7 +11716,7 @@ topics = {'assert': 'The "assert" statement\n'
' Special method names.\n'
'\n'
' Special attributes: "__dict__" is the attribute dictionary;\n'
- ' "__class__" is the instance\'s class.\n'
+ ' "__class__" is the instance’s class.\n'
'\n'
'I/O objects (also known as file objects)\n'
' A *file object* represents an open file. Various shortcuts are\n'
@@ -11508,7 +11728,7 @@ topics = {'assert': 'The "assert" statement\n'
' provided by extension modules).\n'
'\n'
' The objects "sys.stdin", "sys.stdout" and "sys.stderr" are\n'
- " initialized to file objects corresponding to the interpreter's\n"
+ ' initialized to file objects corresponding to the interpreter’s\n'
' standard input, output and error streams; they are all open in '
'text\n'
' mode and therefore follow the interface defined by the\n'
@@ -11526,7 +11746,7 @@ topics = {'assert': 'The "assert" statement\n'
' or *bytecode*. The difference between a code object and a\n'
' function object is that the function object contains an '
'explicit\n'
- " reference to the function's globals (the module in which it "
+ ' reference to the function’s globals (the module in which it '
'was\n'
' defined), while a code object contains no context; also the\n'
' default argument values are stored in the function object, '
@@ -11599,7 +11819,9 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Frame objects\n'
' Frame objects represent execution frames. They may occur in\n'
- ' traceback objects (see below).\n'
+ ' traceback objects (see below), and are also passed to '
+ 'registered\n'
+ ' trace functions.\n'
'\n'
' Special read-only attributes: "f_back" is to the previous '
'stack\n'
@@ -11627,13 +11849,12 @@ topics = {'assert': 'The "assert" statement\n'
' undefined interpreter behaviour if exceptions raised by the\n'
' trace function escape to the function being traced.\n'
'\n'
- ' "f_lineno" is the current line number of the frame --- '
- 'writing\n'
- ' to this from within a trace function jumps to the given line\n'
- ' (only for the bottom-most frame). A debugger can implement '
- 'a\n'
- ' Jump command (aka Set Next Statement) by writing to '
- 'f_lineno.\n'
+ ' "f_lineno" is the current line number of the frame — writing '
+ 'to\n'
+ ' this from within a trace function jumps to the given line '
+ '(only\n'
+ ' for the bottom-most frame). A debugger can implement a Jump\n'
+ ' command (aka Set Next Statement) by writing to f_lineno.\n'
'\n'
' Frame objects support one method:\n'
'\n'
@@ -11656,42 +11877,58 @@ topics = {'assert': 'The "assert" statement\n'
' Traceback objects\n'
' Traceback objects represent a stack trace of an exception. '
'A\n'
- ' traceback object is created when an exception occurs. When '
+ ' traceback object is implicitly created when an exception '
+ 'occurs,\n'
+ ' and may also be explicitly created by calling\n'
+ ' "types.TracebackType".\n'
+ '\n'
+ ' For implicitly created tracebacks, when the search for an\n'
+ ' exception handler unwinds the execution stack, at each '
+ 'unwound\n'
+ ' level a traceback object is inserted in front of the current\n'
+ ' traceback. When an exception handler is entered, the stack\n'
+ ' trace is made available to the program. (See section The try\n'
+ ' statement.) It is accessible as the third item of the tuple\n'
+ ' returned by "sys.exc_info()", and as the "__traceback__"\n'
+ ' attribute of the caught exception.\n'
+ '\n'
+ ' When the program contains no suitable handler, the stack '
+ 'trace\n'
+ ' is written (nicely formatted) to the standard error stream; '
+ 'if\n'
+ ' the interpreter is interactive, it is also made available to '
'the\n'
- ' search for an exception handler unwinds the execution stack, '
- 'at\n'
- ' each unwound level a traceback object is inserted in front '
+ ' user as "sys.last_traceback".\n'
+ '\n'
+ ' For explicitly created tracebacks, it is up to the creator '
'of\n'
- ' the current traceback. When an exception handler is '
- 'entered,\n'
- ' the stack trace is made available to the program. (See '
- 'section\n'
- ' The try statement.) It is accessible as the third item of '
- 'the\n'
- ' tuple returned by "sys.exc_info()". When the program contains '
- 'no\n'
- ' suitable handler, the stack trace is written (nicely '
- 'formatted)\n'
- ' to the standard error stream; if the interpreter is '
- 'interactive,\n'
- ' it is also made available to the user as '
- '"sys.last_traceback".\n'
- '\n'
- ' Special read-only attributes: "tb_next" is the next level in '
+ ' the traceback to determine how the "tb_next" attributes '
+ 'should\n'
+ ' be linked to form a full stack trace.\n'
+ '\n'
+ ' Special read-only attributes: "tb_frame" points to the '
+ 'execution\n'
+ ' frame of the current level; "tb_lineno" gives the line '
+ 'number\n'
+ ' where the exception occurred; "tb_lasti" indicates the '
+ 'precise\n'
+ ' instruction. The line number and last instruction in the\n'
+ ' traceback may differ from the line number of its frame object '
+ 'if\n'
+ ' the exception occurred in a "try" statement with no matching\n'
+ ' except clause or with a finally clause.\n'
+ '\n'
+ ' Special writable attribute: "tb_next" is the next level in '
'the\n'
' stack trace (towards the frame where the exception occurred), '
'or\n'
- ' "None" if there is no next level; "tb_frame" points to the\n'
- ' execution frame of the current level; "tb_lineno" gives the '
- 'line\n'
- ' number where the exception occurred; "tb_lasti" indicates '
- 'the\n'
- ' precise instruction. The line number and last instruction '
- 'in\n'
- ' the traceback may differ from the line number of its frame\n'
- ' object if the exception occurred in a "try" statement with '
- 'no\n'
- ' matching except clause or with a finally clause.\n'
+ ' "None" if there is no next level.\n'
+ '\n'
+ ' Changed in version 3.7: Traceback objects can now be '
+ 'explicitly\n'
+ ' instantiated from Python code, and the "tb_next" attribute '
+ 'of\n'
+ ' existing instances can be updated.\n'
'\n'
' Slice objects\n'
' Slice objects are used to represent slices for '
@@ -11744,7 +11981,7 @@ topics = {'assert': 'The "assert" statement\n'
' is retrieved from classes and class instances. The behaviour '
'of\n'
' class method objects upon such retrieval is described above,\n'
- ' under "User-defined methods". Class method objects are '
+ ' under “User-defined methods”. Class method objects are '
'created\n'
' by the built-in "classmethod()" constructor.\n',
'typesfunctions': 'Functions\n'
@@ -11764,8 +12001,8 @@ topics = {'assert': 'The "assert" statement\n'
'different object types.\n'
'\n'
'See Function definitions for more information.\n',
- 'typesmapping': 'Mapping Types --- "dict"\n'
- '************************\n'
+ 'typesmapping': 'Mapping Types — "dict"\n'
+ '**********************\n'
'\n'
'A *mapping* object maps *hashable* values to arbitrary '
'objects.\n'
@@ -11776,7 +12013,7 @@ topics = {'assert': 'The "assert" statement\n'
'in "list", "set", and "tuple" classes, and the "collections" '
'module.)\n'
'\n'
- "A dictionary's keys are *almost* arbitrary values. Values "
+ 'A dictionary’s keys are *almost* arbitrary values. Values '
'that are\n'
'not *hashable*, that is, values containing lists, '
'dictionaries or\n'
@@ -11932,11 +12169,11 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' Return a shallow copy of the dictionary.\n'
'\n'
- ' classmethod fromkeys(seq[, value])\n'
+ ' classmethod fromkeys(iterable[, value])\n'
'\n'
- ' Create a new dictionary with keys from *seq* and '
- 'values set to\n'
- ' *value*.\n'
+ ' Create a new dictionary with keys from *iterable* and '
+ 'values set\n'
+ ' to *value*.\n'
'\n'
' "fromkeys()" is a class method that returns a new '
'dictionary.\n'
@@ -11952,13 +12189,13 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' items()\n'
'\n'
- ' Return a new view of the dictionary\'s items ("(key, '
+ ' Return a new view of the dictionary’s items ("(key, '
'value)"\n'
' pairs). See the documentation of view objects.\n'
'\n'
' keys()\n'
'\n'
- " Return a new view of the dictionary's keys. See the\n"
+ ' Return a new view of the dictionary’s keys. See the\n'
' documentation of view objects.\n'
'\n'
' pop(key[, default])\n'
@@ -11971,15 +12208,27 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' popitem()\n'
'\n'
- ' Remove and return an arbitrary "(key, value)" pair '
- 'from the\n'
- ' dictionary.\n'
+ ' Remove and return a "(key, value)" pair from the '
+ 'dictionary.\n'
+ ' Pairs are returned in LIFO (last-in, first-out) '
+ 'order.\n'
'\n'
' "popitem()" is useful to destructively iterate over a\n'
' dictionary, as often used in set algorithms. If the '
'dictionary\n'
' is empty, calling "popitem()" raises a "KeyError".\n'
'\n'
+ ' Changed in version 3.7: LIFO order is now guaranteed. '
+ 'In prior\n'
+ ' versions, "popitem()" would return an arbitrary '
+ 'key/value pair.\n'
+ '\n'
+ ' reversed(d)\n'
+ '\n'
+ ' Return a reverse iterator over the keys of the '
+ 'dictionary. This\n'
+ ' is a shortcut for "reversed(d.keys())".\n'
+ '\n'
' setdefault(key[, default])\n'
'\n'
' If *key* is in the dictionary, return its value. If '
@@ -12006,16 +12255,57 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' values()\n'
'\n'
- " Return a new view of the dictionary's values. See "
+ ' Return a new view of the dictionary’s values. See '
'the\n'
' documentation of view objects.\n'
'\n'
' Dictionaries compare equal if and only if they have the '
'same "(key,\n'
- ' value)" pairs. Order comparisons (\'<\', \'<=\', \'>=\', '
- "'>') raise\n"
+ ' value)" pairs. Order comparisons (‘<’, ‘<=’, ‘>=’, ‘>’) '
+ 'raise\n'
' "TypeError".\n'
'\n'
+ ' Dictionaries preserve insertion order. Note that '
+ 'updating a key\n'
+ ' does not affect the order. Keys added after deletion are '
+ 'inserted\n'
+ ' at the end.\n'
+ '\n'
+ ' >>> d = {"one": 1, "two": 2, "three": 3, "four": 4}\n'
+ ' >>> d\n'
+ " {'one': 1, 'two': 2, 'three': 3, 'four': 4}\n"
+ ' >>> list(d)\n'
+ " ['one', 'two', 'three', 'four']\n"
+ ' >>> list(d.values())\n'
+ ' [1, 2, 3, 4]\n'
+ ' >>> d["one"] = 42\n'
+ ' >>> d\n'
+ " {'one': 42, 'two': 2, 'three': 3, 'four': 4}\n"
+ ' >>> del d["two"]\n'
+ ' >>> d["two"] = None\n'
+ ' >>> d\n'
+ " {'one': 42, 'three': 3, 'four': 4, 'two': None}\n"
+ '\n'
+ ' Changed in version 3.7: Dictionary order is guaranteed to '
+ 'be\n'
+ ' insertion order. This behavior was an implementation '
+ 'detail of\n'
+ ' CPython from 3.6.\n'
+ '\n'
+ ' Dictionaries and dictionary views are reversible.\n'
+ '\n'
+ ' >>> d = {"one": 1, "two": 2, "three": 3, "four": 4}\n'
+ ' >>> d\n'
+ " {'one': 1, 'two': 2, 'three': 3, 'four': 4}\n"
+ ' >>> list(reversed(d))\n'
+ " ['four', 'three', 'two', 'one']\n"
+ ' >>> list(reversed(d.values()))\n'
+ ' [4, 3, 2, 1]\n'
+ ' >>> list(reversed(d.items()))\n'
+ " [('four', 4), ('three', 3), ('two', 2), ('one', 1)]\n"
+ '\n'
+ ' Changed in version 3.8: Dictionaries are now reversible.\n'
+ '\n'
'See also: "types.MappingProxyType" can be used to create a '
'read-only\n'
' view of a "dict".\n'
@@ -12027,7 +12317,7 @@ topics = {'assert': 'The "assert" statement\n'
'The objects returned by "dict.keys()", "dict.values()" and\n'
'"dict.items()" are *view objects*. They provide a dynamic '
'view on the\n'
- "dictionary's entries, which means that when the dictionary "
+ 'dictionary’s entries, which means that when the dictionary '
'changes,\n'
'the view reflects these changes.\n'
'\n'
@@ -12045,36 +12335,42 @@ topics = {'assert': 'The "assert" statement\n'
'(represented as\n'
' tuples of "(key, value)") in the dictionary.\n'
'\n'
- ' Keys and values are iterated over in an arbitrary order '
- 'which is\n'
- ' non-random, varies across Python implementations, and '
- 'depends on\n'
- " the dictionary's history of insertions and deletions. If "
- 'keys,\n'
- ' values and items views are iterated over with no '
- 'intervening\n'
- ' modifications to the dictionary, the order of items will '
- 'directly\n'
- ' correspond. This allows the creation of "(value, key)" '
- 'pairs using\n'
- ' "zip()": "pairs = zip(d.values(), d.keys())". Another '
- 'way to\n'
- ' create the same list is "pairs = [(v, k) for (k, v) in '
- 'd.items()]".\n'
+ ' Keys and values are iterated over in insertion order. '
+ 'This allows\n'
+ ' the creation of "(value, key)" pairs using "zip()": '
+ '"pairs =\n'
+ ' zip(d.values(), d.keys())". Another way to create the '
+ 'same list is\n'
+ ' "pairs = [(v, k) for (k, v) in d.items()]".\n'
'\n'
' Iterating views while adding or deleting entries in the '
'dictionary\n'
' may raise a "RuntimeError" or fail to iterate over all '
'entries.\n'
'\n'
+ ' Changed in version 3.7: Dictionary order is guaranteed to '
+ 'be\n'
+ ' insertion order.\n'
+ '\n'
'x in dictview\n'
'\n'
- ' Return "True" if *x* is in the underlying dictionary\'s '
+ ' Return "True" if *x* is in the underlying dictionary’s '
'keys, values\n'
' or items (in the latter case, *x* should be a "(key, '
'value)"\n'
' tuple).\n'
'\n'
+ 'reversed(dictview)\n'
+ '\n'
+ ' Return a reverse iterator over the keys, values or items '
+ 'of the\n'
+ ' dictionary. The view will be iterated in reverse order of '
+ 'the\n'
+ ' insertion.\n'
+ '\n'
+ ' Changed in version 3.8: Dictionary views are now '
+ 'reversible.\n'
+ '\n'
'Keys views are set-like since their entries are unique and '
'hashable.\n'
'If all values are hashable, so that "(key, value)" pairs are '
@@ -12103,10 +12399,10 @@ topics = {'assert': 'The "assert" statement\n'
' >>> print(n)\n'
' 504\n'
'\n'
- ' >>> # keys and values are iterated over in the same '
- 'order\n'
+ ' >>> # keys and values are iterated over in the same order '
+ '(insertion order)\n'
' >>> list(keys)\n'
- " ['eggs', 'bacon', 'sausage', 'spam']\n"
+ " ['eggs', 'sausage', 'bacon', 'spam']\n"
' >>> list(values)\n'
' [2, 1, 1, 500]\n'
'\n'
@@ -12114,7 +12410,7 @@ topics = {'assert': 'The "assert" statement\n'
" >>> del dishes['eggs']\n"
" >>> del dishes['sausage']\n"
' >>> list(keys)\n'
- " ['spam', 'bacon']\n"
+ " ['bacon', 'spam']\n"
'\n'
' >>> # set operations\n'
" >>> keys & {'eggs', 'bacon', 'salad'}\n"
@@ -12184,7 +12480,7 @@ topics = {'assert': 'The "assert" statement\n'
'The only special operation on a module is attribute access: '
'"m.name",\n'
'where *m* is a module and *name* accesses a name defined in '
- "*m*'s\n"
+ '*m*’s\n'
'symbol table. Module attributes can be assigned to. (Note '
'that the\n'
'"import" statement is not, strictly speaking, an operation '
@@ -12197,14 +12493,14 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'A special attribute of every module is "__dict__". This is '
'the\n'
- "dictionary containing the module's symbol table. Modifying "
+ 'dictionary containing the module’s symbol table. Modifying '
'this\n'
- "dictionary will actually change the module's symbol table, "
+ 'dictionary will actually change the module’s symbol table, '
'but direct\n'
'assignment to the "__dict__" attribute is not possible (you '
'can write\n'
'"m.__dict__[\'a\'] = 1", which defines "m.a" to be "1", but '
- "you can't\n"
+ 'you can’t\n'
'write "m.__dict__ = {}"). Modifying "__dict__" directly is '
'not\n'
'recommended.\n'
@@ -12215,8 +12511,8 @@ topics = {'assert': 'The "assert" statement\n'
'written as\n'
'"<module \'os\' from '
'\'/usr/local/lib/pythonX.Y/os.pyc\'>".\n',
- 'typesseq': 'Sequence Types --- "list", "tuple", "range"\n'
- '*******************************************\n'
+ 'typesseq': 'Sequence Types — "list", "tuple", "range"\n'
+ '*****************************************\n'
'\n'
'There are three basic sequence types: lists, tuples, and range\n'
'objects. Additional sequence types tailored for processing of '
@@ -12390,7 +12686,7 @@ topics = {'assert': 'The "assert" statement\n'
'*j* are\n'
' reduced to "len(s) - 1" if they are greater. If *i* or *j* '
'are\n'
- ' omitted or "None", they become "end" values (which end '
+ ' omitted or "None", they become “end” values (which end '
'depends on\n'
' the sign of *k*). Note, *k* cannot be zero. If *k* is '
'"None", it\n'
@@ -12421,7 +12717,7 @@ topics = {'assert': 'The "assert" statement\n'
'documentation\n'
'\n'
'7. Some sequence types (such as "range") only support item\n'
- " sequences that follow specific patterns, and hence don't "
+ ' sequences that follow specific patterns, and hence don’t '
'support\n'
' sequence concatenation or repetition.\n'
'\n'
@@ -12515,13 +12811,13 @@ topics = {'assert': 'The "assert" statement\n'
'| | "s[len(s):len(s)] = '
'[x]") | |\n'
'+--------------------------------+----------------------------------+-----------------------+\n'
- '| "s.clear()" | removes all items from "s" '
+ '| "s.clear()" | removes all items from *s* '
'(same | (5) |\n'
'| | as "del '
's[:]") | |\n'
'+--------------------------------+----------------------------------+-----------------------+\n'
'| "s.copy()" | creates a shallow copy of '
- '"s" | (5) |\n'
+ '*s* | (5) |\n'
'| | (same as '
'"s[:]") | |\n'
'+--------------------------------+----------------------------------+-----------------------+\n'
@@ -12578,7 +12874,7 @@ topics = {'assert': 'The "assert" statement\n'
' sequence.\n'
'\n'
'5. "clear()" and "copy()" are included for consistency with the\n'
- " interfaces of mutable containers that don't support slicing\n"
+ ' interfaces of mutable containers that don’t support slicing\n'
' operations (such as "dict" and "set")\n'
'\n'
' New in version 3.3: "clear()" and "copy()" methods.\n'
@@ -12618,7 +12914,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' The constructor builds a list whose items are the same and in '
'the\n'
- " same order as *iterable*'s items. *iterable* may be either "
+ ' same order as *iterable*’s items. *iterable* may be either '
'a\n'
' sequence, a container that supports iteration, or an '
'iterator\n'
@@ -12685,12 +12981,16 @@ topics = {'assert': 'The "assert" statement\n'
'is\n'
' stable if it guarantees not to change the relative order '
'of\n'
- ' elements that compare equal --- this is helpful for '
- 'sorting in\n'
+ ' elements that compare equal — this is helpful for sorting '
+ 'in\n'
' multiple passes (for example, sort by department, then by '
'salary\n'
' grade).\n'
'\n'
+ ' For sorting examples and a brief sorting tutorial, see '
+ 'Sorting\n'
+ ' HOW TO.\n'
+ '\n'
' **CPython implementation detail:** While a list is being '
'sorted,\n'
' the effect of attempting to mutate, or even inspect, the '
@@ -12732,7 +13032,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' The constructor builds a tuple whose items are the same and '
'in the\n'
- " same order as *iterable*'s items. *iterable* may be either "
+ ' same order as *iterable*’s items. *iterable* may be either '
'a\n'
' sequence, a container that supports iteration, or an '
'iterator\n'
@@ -12861,7 +13161,7 @@ topics = {'assert': 'The "assert" statement\n'
'Range objects implement the "collections.abc.Sequence" ABC, and\n'
'provide features such as containment tests, element index '
'lookup,\n'
- 'slicing and support for negative indices (see Sequence Types --- '
+ 'slicing and support for negative indices (see Sequence Types — '
'list,\n'
'tuple, range):\n'
'\n'
@@ -12899,7 +13199,7 @@ topics = {'assert': 'The "assert" statement\n'
'constant\n'
'time instead of iterating through all items.\n'
'\n'
- "Changed in version 3.3: Define '==' and '!=' to compare range "
+ 'Changed in version 3.3: Define ‘==’ and ‘!=’ to compare range '
'objects\n'
'based on the sequence of values they define (instead of '
'comparing\n'
@@ -12911,7 +13211,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
' * The linspace recipe shows how to implement a lazy version '
'of\n'
- ' range that suitable for floating point applications.\n',
+ ' range suitable for floating point applications.\n',
'typesseq-mutable': 'Mutable Sequence Types\n'
'**********************\n'
'\n'
@@ -12971,12 +13271,12 @@ topics = {'assert': 'The "assert" statement\n'
'[x]") | |\n'
'+--------------------------------+----------------------------------+-----------------------+\n'
'| "s.clear()" | removes all items '
- 'from "s" (same | (5) |\n'
+ 'from *s* (same | (5) |\n'
'| | as "del '
's[:]") | |\n'
'+--------------------------------+----------------------------------+-----------------------+\n'
'| "s.copy()" | creates a shallow '
- 'copy of "s" | (5) |\n'
+ 'copy of *s* | (5) |\n'
'| | (same as '
'"s[:]") | |\n'
'+--------------------------------+----------------------------------+-----------------------+\n'
@@ -13038,7 +13338,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'5. "clear()" and "copy()" are included for consistency '
'with the\n'
- " interfaces of mutable containers that don't support "
+ ' interfaces of mutable containers that don’t support '
'slicing\n'
' operations (such as "dict" and "set")\n'
'\n'
@@ -13093,7 +13393,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'A "break" statement executed in the first suite terminates the '
'loop\n'
- 'without executing the "else" clause\'s suite. A "continue" '
+ 'without executing the "else" clause’s suite. A "continue" '
'statement\n'
'executed in the first suite skips the rest of the suite and goes '
'back\n'
@@ -13103,21 +13403,22 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'The "with" statement is used to wrap the execution of a block with\n'
'methods defined by a context manager (see section With Statement\n'
- 'Context Managers). This allows common "try"..."except"..."finally"\n'
- 'usage patterns to be encapsulated for convenient reuse.\n'
+ 'Context Managers). This allows common "try"…"except"…"finally" '
+ 'usage\n'
+ 'patterns to be encapsulated for convenient reuse.\n'
'\n'
' with_stmt ::= "with" with_item ("," with_item)* ":" suite\n'
' with_item ::= expression ["as" target]\n'
'\n'
- 'The execution of the "with" statement with one "item" proceeds as\n'
+ 'The execution of the "with" statement with one “item” proceeds as\n'
'follows:\n'
'\n'
'1. The context expression (the expression given in the "with_item")\n'
' is evaluated to obtain a context manager.\n'
'\n'
- '2. The context manager\'s "__exit__()" is loaded for later use.\n'
+ '2. The context manager’s "__exit__()" is loaded for later use.\n'
'\n'
- '3. The context manager\'s "__enter__()" method is invoked.\n'
+ '3. The context manager’s "__enter__()" method is invoked.\n'
'\n'
'4. If a target was included in the "with" statement, the return\n'
' value from "__enter__()" is assigned to it.\n'
@@ -13131,7 +13432,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'5. The suite is executed.\n'
'\n'
- '6. The context manager\'s "__exit__()" method is invoked. If an\n'
+ '6. The context manager’s "__exit__()" method is invoked. If an\n'
' exception caused the suite to be exited, its type, value, and\n'
' traceback are passed as arguments to "__exit__()". Otherwise, '
'three\n'
@@ -13167,7 +13468,7 @@ topics = {'assert': 'The "assert" statement\n'
'\n'
'See also:\n'
'\n'
- ' **PEP 343** - The "with" statement\n'
+ ' **PEP 343** - The “with” statement\n'
' The specification, background, and examples for the Python '
'"with"\n'
' statement.\n',