|
1 | 1 | # -*- coding: utf-8 -*-
|
2 |
| -# Autogenerated by Sphinx on Thu Jan 13 21:46:32 2022 |
| 2 | +# Autogenerated by Sphinx on Tue Mar 15 21:44:32 2022 |
3 | 3 | topics = {'assert': 'The "assert" statement\n'
|
4 | 4 | '**********************\n'
|
5 | 5 | '\n'
|
|
5408 | 5408 | 'with an\n'
|
5409 | 5409 | '*alignment* type of "\'=\'".\n'
|
5410 | 5410 | '\n'
|
5411 |
| - 'The *precision* is a decimal number indicating how many ' |
| 5411 | + 'The *precision* is a decimal integer indicating how many ' |
5412 | 5412 | 'digits should\n'
|
5413 |
| - 'be displayed after the decimal point for a floating point ' |
5414 |
| - 'value\n' |
5415 |
| - 'formatted with "\'f\'" and "\'F\'", or before and after the ' |
5416 |
| - 'decimal point\n' |
5417 |
| - 'for a floating point value formatted with "\'g\'" or ' |
5418 |
| - '"\'G\'". For non-\n' |
5419 |
| - 'number types the field indicates the maximum field size - ' |
5420 |
| - 'in other\n' |
5421 |
| - 'words, how many characters will be used from the field ' |
5422 |
| - 'content. The\n' |
5423 |
| - '*precision* is not allowed for integer values.\n' |
| 5413 | + 'be displayed after the decimal point for presentation types ' |
| 5414 | + '"\'f\'" and\n' |
| 5415 | + '"\'F\'", or before and after the decimal point for ' |
| 5416 | + 'presentation types\n' |
| 5417 | + '"\'g\'" or "\'G\'". For string presentation types the ' |
| 5418 | + 'field indicates the\n' |
| 5419 | + 'maximum field size - in other words, how many characters ' |
| 5420 | + 'will be used\n' |
| 5421 | + 'from the field content. The *precision* is not allowed for ' |
| 5422 | + 'integer\n' |
| 5423 | + 'presentation types.\n' |
5424 | 5424 | '\n'
|
5425 | 5425 | 'Finally, the *type* determines how the data should be '
|
5426 | 5426 | 'presented.\n'
|
|
7515 | 7515 | '\n'
|
7516 | 7516 | ' raise_stmt ::= "raise" [expression ["from" expression]]\n'
|
7517 | 7517 | '\n'
|
7518 |
| - 'If no expressions are present, "raise" re-raises the last ' |
7519 |
| - 'exception\n' |
7520 |
| - 'that was active in the current scope. If no exception is active ' |
7521 |
| - 'in\n' |
7522 |
| - 'the current scope, a "RuntimeError" exception is raised indicating\n' |
7523 |
| - 'that this is an error.\n' |
| 7518 | + 'If no expressions are present, "raise" re-raises the exception that ' |
| 7519 | + 'is\n' |
| 7520 | + 'currently being handled, which is also known as the *active\n' |
| 7521 | + 'exception*. If there isn’t currently an active exception, a\n' |
| 7522 | + '"RuntimeError" exception is raised indicating that this is an ' |
| 7523 | + 'error.\n' |
7524 | 7524 | '\n'
|
7525 | 7525 | 'Otherwise, "raise" evaluates the first expression as the exception\n'
|
7526 | 7526 | 'object. It must be either a subclass or an instance of\n'
|
|
7575 | 7575 | ' File "<stdin>", line 4, in <module>\n'
|
7576 | 7576 | ' RuntimeError: Something bad happened\n'
|
7577 | 7577 | '\n'
|
7578 |
| - 'A similar mechanism works implicitly if an exception is raised ' |
7579 |
| - 'inside\n' |
7580 |
| - 'an exception handler or a "finally" clause: the previous exception ' |
7581 |
| - 'is\n' |
7582 |
| - 'then attached as the new exception’s "__context__" attribute:\n' |
| 7578 | + 'A similar mechanism works implicitly if a new exception is raised ' |
| 7579 | + 'when\n' |
| 7580 | + 'an exception is already being handled. An exception may be ' |
| 7581 | + 'handled\n' |
| 7582 | + 'when an "except" or "finally" clause, or a "with" statement, is ' |
| 7583 | + 'used.\n' |
| 7584 | + 'The previous exception is then attached as the new exception’s\n' |
| 7585 | + '"__context__" attribute:\n' |
7583 | 7586 | '\n'
|
7584 | 7587 | ' >>> try:\n'
|
7585 | 7588 | ' ... print(1 / 0)\n'
|
|
9079 | 9082 | '\n'
|
9080 | 9083 | 'Whenever a class inherits from another class, '
|
9081 | 9084 | '"__init_subclass__()" is\n'
|
9082 |
| - 'called on that class. This way, it is possible to write ' |
9083 |
| - 'classes which\n' |
9084 |
| - 'change the behavior of subclasses. This is closely related ' |
9085 |
| - 'to class\n' |
9086 |
| - 'decorators, but where class decorators only affect the ' |
9087 |
| - 'specific class\n' |
9088 |
| - 'they’re applied to, "__init_subclass__" solely applies to ' |
9089 |
| - 'future\n' |
| 9085 | + 'called on the parent class. This way, it is possible to ' |
| 9086 | + 'write classes\n' |
| 9087 | + 'which change the behavior of subclasses. This is closely ' |
| 9088 | + 'related to\n' |
| 9089 | + 'class decorators, but where class decorators only affect the ' |
| 9090 | + 'specific\n' |
| 9091 | + 'class they’re applied to, "__init_subclass__" solely applies ' |
| 9092 | + 'to future\n' |
9090 | 9093 | 'subclasses of the class defining the method.\n'
|
9091 | 9094 | '\n'
|
9092 | 9095 | 'classmethod object.__init_subclass__(cls)\n'
|
@@ -11393,67 +11396,86 @@
|
11393 | 11396 | 'subscriptions': 'Subscriptions\n'
|
11394 | 11397 | '*************\n'
|
11395 | 11398 | '\n'
|
11396 |
| - 'Subscription of a sequence (string, tuple or list) or ' |
11397 |
| - 'mapping\n' |
11398 |
| - '(dictionary) object usually selects an item from the ' |
11399 |
| - 'collection:\n' |
| 11399 | + 'The subscription of an instance of a container class will ' |
| 11400 | + 'generally\n' |
| 11401 | + 'select an element from the container. The subscription of a ' |
| 11402 | + '*generic\n' |
| 11403 | + 'class* will generally return a GenericAlias object.\n' |
11400 | 11404 | '\n'
|
11401 | 11405 | ' subscription ::= primary "[" expression_list "]"\n'
|
11402 | 11406 | '\n'
|
| 11407 | + 'When an object is subscripted, the interpreter will ' |
| 11408 | + 'evaluate the\n' |
| 11409 | + 'primary and the expression list.\n' |
| 11410 | + '\n' |
11403 | 11411 | 'The primary must evaluate to an object that supports '
|
11404 |
| - 'subscription\n' |
11405 |
| - '(lists or dictionaries for example). User-defined objects ' |
11406 |
| - 'can support\n' |
11407 |
| - 'subscription by defining a "__getitem__()" method.\n' |
| 11412 | + 'subscription. An\n' |
| 11413 | + 'object may support subscription through defining one or ' |
| 11414 | + 'both of\n' |
| 11415 | + '"__getitem__()" and "__class_getitem__()". When the primary ' |
| 11416 | + 'is\n' |
| 11417 | + 'subscripted, the evaluated result of the expression list ' |
| 11418 | + 'will be\n' |
| 11419 | + 'passed to one of these methods. For more details on when\n' |
| 11420 | + '"__class_getitem__" is called instead of "__getitem__", ' |
| 11421 | + 'see\n' |
| 11422 | + '__class_getitem__ versus __getitem__.\n' |
| 11423 | + '\n' |
| 11424 | + 'If the expression list contains at least one comma, it will ' |
| 11425 | + 'evaluate\n' |
| 11426 | + 'to a "tuple" containing the items of the expression list. ' |
| 11427 | + 'Otherwise,\n' |
| 11428 | + 'the expression list will evaluate to the value of the ' |
| 11429 | + 'list’s sole\n' |
| 11430 | + 'member.\n' |
11408 | 11431 | '\n'
|
11409 | 11432 | 'For built-in objects, there are two types of objects that '
|
11410 | 11433 | 'support\n'
|
11411 |
| - 'subscription:\n' |
| 11434 | + 'subscription via "__getitem__()":\n' |
11412 | 11435 | '\n'
|
11413 |
| - 'If the primary is a mapping, the expression list must ' |
11414 |
| - 'evaluate to an\n' |
11415 |
| - 'object whose value is one of the keys of the mapping, and ' |
| 11436 | + '1. Mappings. If the primary is a *mapping*, the expression ' |
| 11437 | + 'list must\n' |
| 11438 | + ' evaluate to an object whose value is one of the keys of ' |
11416 | 11439 | 'the\n'
|
11417 |
| - 'subscription selects the value in the mapping that ' |
11418 |
| - 'corresponds to that\n' |
11419 |
| - 'key. (The expression list is a tuple except if it has ' |
11420 |
| - 'exactly one\n' |
11421 |
| - 'item.)\n' |
11422 |
| - '\n' |
11423 |
| - 'If the primary is a sequence, the expression list must ' |
11424 |
| - 'evaluate to an\n' |
11425 |
| - 'integer or a slice (as discussed in the following ' |
11426 |
| - 'section).\n' |
| 11440 | + ' mapping, and the subscription selects the value in the ' |
| 11441 | + 'mapping that\n' |
| 11442 | + ' corresponds to that key. An example of a builtin mapping ' |
| 11443 | + 'class is\n' |
| 11444 | + ' the "dict" class.\n' |
| 11445 | + '\n' |
| 11446 | + '2. Sequences. If the primary is a *sequence*, the ' |
| 11447 | + 'expression list must\n' |
| 11448 | + ' evaluate to an "int" or a "slice" (as discussed in the ' |
| 11449 | + 'following\n' |
| 11450 | + ' section). Examples of builtin sequence classes include ' |
| 11451 | + 'the "str",\n' |
| 11452 | + ' "list" and "tuple" classes.\n' |
11427 | 11453 | '\n'
|
11428 | 11454 | 'The formal syntax makes no special provision for negative '
|
11429 | 11455 | 'indices in\n'
|
11430 |
| - 'sequences; however, built-in sequences all provide a ' |
| 11456 | + '*sequences*. However, built-in sequences all provide a ' |
11431 | 11457 | '"__getitem__()"\n'
|
11432 | 11458 | 'method that interprets negative indices by adding the '
|
11433 | 11459 | 'length of the\n'
|
11434 |
| - 'sequence to the index (so that "x[-1]" selects the last ' |
11435 |
| - 'item of "x").\n' |
11436 |
| - 'The resulting value must be a nonnegative integer less than ' |
11437 |
| - 'the number\n' |
11438 |
| - 'of items in the sequence, and the subscription selects the ' |
11439 |
| - 'item whose\n' |
11440 |
| - 'index is that value (counting from zero). Since the support ' |
11441 |
| - 'for\n' |
11442 |
| - 'negative indices and slicing occurs in the object’s ' |
11443 |
| - '"__getitem__()"\n' |
11444 |
| - 'method, subclasses overriding this method will need to ' |
11445 |
| - 'explicitly add\n' |
11446 |
| - 'that support.\n' |
11447 |
| - '\n' |
11448 |
| - 'A string’s items are characters. A character is not a ' |
11449 |
| - 'separate data\n' |
11450 |
| - 'type but a string of exactly one character.\n' |
11451 |
| - '\n' |
11452 |
| - 'Subscription of certain *classes* or *types* creates a ' |
11453 |
| - 'generic alias.\n' |
11454 |
| - 'In this case, user-defined classes can support subscription ' |
11455 |
| - 'by\n' |
11456 |
| - 'providing a "__class_getitem__()" classmethod.\n', |
| 11460 | + 'sequence to the index so that, for example, "x[-1]" selects ' |
| 11461 | + 'the last\n' |
| 11462 | + 'item of "x". The resulting value must be a nonnegative ' |
| 11463 | + 'integer less\n' |
| 11464 | + 'than the number of items in the sequence, and the ' |
| 11465 | + 'subscription selects\n' |
| 11466 | + 'the item whose index is that value (counting from zero). ' |
| 11467 | + 'Since the\n' |
| 11468 | + 'support for negative indices and slicing occurs in the ' |
| 11469 | + 'object’s\n' |
| 11470 | + '"__getitem__()" method, subclasses overriding this method ' |
| 11471 | + 'will need to\n' |
| 11472 | + 'explicitly add that support.\n' |
| 11473 | + '\n' |
| 11474 | + 'A "string" is a special kind of sequence whose items are ' |
| 11475 | + '*characters*.\n' |
| 11476 | + 'A character is not a separate data type but a string of ' |
| 11477 | + 'exactly one\n' |
| 11478 | + 'character.\n', |
11457 | 11479 | 'truth': 'Truth Value Testing\n'
|
11458 | 11480 | '*******************\n'
|
11459 | 11481 | '\n'
|
|
0 commit comments