|
1 | 1 | # -*- coding: utf-8 -*- |
2 | | -# Autogenerated by Sphinx on Sat Jul 10 01:50:39 2021 |
| 2 | +# Autogenerated by Sphinx on Mon Aug 2 20:07:41 2021 |
3 | 3 | topics = {'assert': 'The "assert" statement\n' |
4 | 4 | '**********************\n' |
5 | 5 | '\n' |
|
1313 | 1313 | 'In the latter case, sequence repetition is performed; a negative\n' |
1314 | 1314 | 'repetition factor yields an empty sequence.\n' |
1315 | 1315 | '\n' |
| 1316 | + 'This operation can be customized using the special "__mul__()" ' |
| 1317 | + 'and\n' |
| 1318 | + '"__rmul__()" methods.\n' |
| 1319 | + '\n' |
1316 | 1320 | 'The "@" (at) operator is intended to be used for matrix\n' |
1317 | 1321 | 'multiplication. No builtin Python types implement this operator.\n' |
1318 | 1322 | '\n' |
|
1328 | 1332 | 'result. Division by zero raises the "ZeroDivisionError" ' |
1329 | 1333 | 'exception.\n' |
1330 | 1334 | '\n' |
| 1335 | + 'This operation can be customized using the special "__div__()" ' |
| 1336 | + 'and\n' |
| 1337 | + '"__floordiv__()" methods.\n' |
| 1338 | + '\n' |
1331 | 1339 | 'The "%" (modulo) operator yields the remainder from the division ' |
1332 | 1340 | 'of\n' |
1333 | 1341 | 'the first argument by the second. The numeric arguments are ' |
|
1359 | 1367 | 'string formatting is described in the Python Library Reference,\n' |
1360 | 1368 | 'section printf-style String Formatting.\n' |
1361 | 1369 | '\n' |
| 1370 | + 'The *modulo* operation can be customized using the special ' |
| 1371 | + '"__mod__()"\n' |
| 1372 | + 'method.\n' |
| 1373 | + '\n' |
1362 | 1374 | 'The floor division operator, the modulo operator, and the ' |
1363 | 1375 | '"divmod()"\n' |
1364 | 1376 | 'function are not defined for complex numbers. Instead, convert to ' |
|
1373 | 1385 | 'and then added together. In the latter case, the sequences are\n' |
1374 | 1386 | 'concatenated.\n' |
1375 | 1387 | '\n' |
| 1388 | + 'This operation can be customized using the special "__add__()" ' |
| 1389 | + 'and\n' |
| 1390 | + '"__radd__()" methods.\n' |
| 1391 | + '\n' |
1376 | 1392 | 'The "-" (subtraction) operator yields the difference of its ' |
1377 | 1393 | 'arguments.\n' |
1378 | | - 'The numeric arguments are first converted to a common type.\n', |
| 1394 | + 'The numeric arguments are first converted to a common type.\n' |
| 1395 | + '\n' |
| 1396 | + 'This operation can be customized using the special "__sub__()" ' |
| 1397 | + 'method.\n', |
1379 | 1398 | 'bitwise': 'Binary bitwise operations\n' |
1380 | 1399 | '*************************\n' |
1381 | 1400 | '\n' |
|
1388 | 1407 | '\n' |
1389 | 1408 | 'The "&" operator yields the bitwise AND of its arguments, which ' |
1390 | 1409 | 'must\n' |
1391 | | - 'be integers.\n' |
| 1410 | + 'be integers or one of them must be a custom object overriding\n' |
| 1411 | + '"__and__()" or "__rand__()" special methods.\n' |
1392 | 1412 | '\n' |
1393 | 1413 | 'The "^" operator yields the bitwise XOR (exclusive OR) of its\n' |
1394 | | - 'arguments, which must be integers.\n' |
| 1414 | + 'arguments, which must be integers or one of them must be a ' |
| 1415 | + 'custom\n' |
| 1416 | + 'object overriding "__xor__()" or "__rxor__()" special methods.\n' |
1395 | 1417 | '\n' |
1396 | 1418 | 'The "|" operator yields the bitwise (inclusive) OR of its ' |
1397 | 1419 | 'arguments,\n' |
1398 | | - 'which must be integers.\n', |
| 1420 | + 'which must be integers or one of them must be a custom object\n' |
| 1421 | + 'overriding "__or__()" or "__ror__()" special methods.\n', |
1399 | 1422 | 'bltin-code-objects': 'Code Objects\n' |
1400 | 1423 | '************\n' |
1401 | 1424 | '\n' |
|
1841 | 1864 | ' comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n' |
1842 | 1865 | ' | "is" ["not"] | ["not"] "in"\n' |
1843 | 1866 | '\n' |
1844 | | - 'Comparisons yield boolean values: "True" or "False".\n' |
| 1867 | + 'Comparisons yield boolean values: "True" or "False". Custom ' |
| 1868 | + '*rich\n' |
| 1869 | + 'comparison methods* may return non-boolean values. In this ' |
| 1870 | + 'case Python\n' |
| 1871 | + 'will call "bool()" on such value in boolean contexts.\n' |
1845 | 1872 | '\n' |
1846 | 1873 | 'Comparisons can be chained arbitrarily, e.g., "x < y <= z" ' |
1847 | 1874 | 'is\n' |
|
3270 | 3297 | 'double star pattern must be the last subpattern in the mapping\n' |
3271 | 3298 | 'pattern.\n' |
3272 | 3299 | '\n' |
3273 | | - 'Duplicate key values in mapping patterns are disallowed. (If all ' |
3274 | | - 'key\n' |
3275 | | - 'patterns are literal patterns this is considered a syntax ' |
3276 | | - 'error;\n' |
3277 | | - 'otherwise this is a runtime error and will raise "ValueError".)\n' |
| 3300 | + 'Duplicate keys in mapping patterns are disallowed. Duplicate ' |
| 3301 | + 'literal\n' |
| 3302 | + 'keys will raise a "SyntaxError". Two keys that otherwise have ' |
| 3303 | + 'the same\n' |
| 3304 | + 'value will raise a "ValueError" at runtime.\n' |
3278 | 3305 | '\n' |
3279 | 3306 | 'The following is the logical flow for matching a mapping ' |
3280 | 3307 | 'pattern\n' |
|
3292 | 3319 | '\n' |
3293 | 3320 | '3. If duplicate keys are detected in the mapping pattern, the ' |
3294 | 3321 | 'pattern\n' |
3295 | | - ' is considered invalid and "ValueError" is raised.\n' |
| 3322 | + ' is considered invalid. A "SyntaxError" is raised for ' |
| 3323 | + 'duplicate\n' |
| 3324 | + ' literal values; or a "ValueError" for named keys of the same ' |
| 3325 | + 'value.\n' |
3296 | 3326 | '\n' |
3297 | 3327 | 'Note:\n' |
3298 | 3328 | '\n' |
|
8373 | 8403 | '"ZeroDivisionError".\n' |
8374 | 8404 | 'Raising a negative number to a fractional power results in a ' |
8375 | 8405 | '"complex"\n' |
8376 | | - 'number. (In earlier versions it raised a "ValueError".)\n', |
| 8406 | + 'number. (In earlier versions it raised a "ValueError".)\n' |
| 8407 | + '\n' |
| 8408 | + 'This operation can be customized using the special "__pow__()" ' |
| 8409 | + 'method.\n', |
8377 | 8410 | 'raise': 'The "raise" statement\n' |
8378 | 8411 | '*********************\n' |
8379 | 8412 | '\n' |
|
8773 | 8806 | 'the\n' |
8774 | 8807 | 'second argument.\n' |
8775 | 8808 | '\n' |
| 8809 | + 'This operation can be customized using the special ' |
| 8810 | + '"__lshift__()" and\n' |
| 8811 | + '"__rshift__()" methods.\n' |
| 8812 | + '\n' |
8776 | 8813 | 'A right shift by *n* bits is defined as floor division by ' |
8777 | 8814 | '"pow(2,n)".\n' |
8778 | 8815 | 'A left shift by *n* bits is defined as multiplication with ' |
|
14423 | 14460 | '| | "s[i:i] = ' |
14424 | 14461 | '[x]") | |\n' |
14425 | 14462 | '+--------------------------------+----------------------------------+-----------------------+\n' |
14426 | | - '| "s.pop([i])" | retrieves the item at *i* ' |
| 14463 | + '| "s.pop()" or "s.pop(i)" | retrieves the item at *i* ' |
14427 | 14464 | 'and | (2) |\n' |
14428 | 14465 | '| | also removes it from ' |
14429 | 14466 | '*s* | |\n' |
|
14886 | 14923 | '| | "s[i:i] = ' |
14887 | 14924 | '[x]") | |\n' |
14888 | 14925 | '+--------------------------------+----------------------------------+-----------------------+\n' |
14889 | | - '| "s.pop([i])" | retrieves the item at ' |
| 14926 | + '| "s.pop()" or "s.pop(i)" | retrieves the item at ' |
14890 | 14927 | '*i* and | (2) |\n' |
14891 | 14928 | '| | also removes it from ' |
14892 | 14929 | '*s* | |\n' |
@@ -14951,15 +14988,21 @@ |
14951 | 14988 | ' u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n' |
14952 | 14989 | '\n' |
14953 | 14990 | 'The unary "-" (minus) operator yields the negation of its numeric\n' |
14954 | | - 'argument.\n' |
| 14991 | + 'argument; the operation can be overridden with the "__neg__()" ' |
| 14992 | + 'special\n' |
| 14993 | + 'method.\n' |
14955 | 14994 | '\n' |
14956 | 14995 | 'The unary "+" (plus) operator yields its numeric argument ' |
14957 | | - 'unchanged.\n' |
| 14996 | + 'unchanged;\n' |
| 14997 | + 'the operation can be overridden with the "__pos__()" special ' |
| 14998 | + 'method.\n' |
14958 | 14999 | '\n' |
14959 | 15000 | 'The unary "~" (invert) operator yields the bitwise inversion of ' |
14960 | 15001 | 'its\n' |
14961 | 15002 | 'integer argument. The bitwise inversion of "x" is defined as\n' |
14962 | | - '"-(x+1)". It only applies to integral numbers.\n' |
| 15003 | + '"-(x+1)". It only applies to integral numbers or to custom ' |
| 15004 | + 'objects\n' |
| 15005 | + 'that override the "__invert__()" special method.\n' |
14963 | 15006 | '\n' |
14964 | 15007 | 'In all three cases, if the argument does not have the proper type, ' |
14965 | 15008 | 'a\n' |
|
0 commit comments