|
1 | 1 | # -*- coding: utf-8 -*- |
2 | | -# Autogenerated by Sphinx on Mon May 16 13:41:38 2016 |
| 2 | +# Autogenerated by Sphinx on Mon Jun 13 16:49:58 2016 |
3 | 3 | topics = {'assert': '\n' |
4 | 4 | 'The "assert" statement\n' |
5 | 5 | '**********************\n' |
|
47 | 47 | 'to\n' |
48 | 48 | 'modify attributes or items of mutable objects:\n' |
49 | 49 | '\n' |
50 | | - ' assignment_stmt ::= (target_list "=")+ (expression_list | ' |
51 | | - 'yield_expression)\n' |
| 50 | + ' assignment_stmt ::= (target_list "=")+ (starred_expression ' |
| 51 | + '| yield_expression)\n' |
52 | 52 | ' target_list ::= target ("," target)* [","]\n' |
53 | 53 | ' target ::= identifier\n' |
54 | | - ' | "(" target_list ")"\n' |
55 | | - ' | "[" target_list "]"\n' |
| 54 | + ' | "(" [target_list] ")"\n' |
| 55 | + ' | "[" [target_list] "]"\n' |
56 | 56 | ' | attributeref\n' |
57 | 57 | ' | subscription\n' |
58 | 58 | ' | slicing\n' |
|
89 | 89 | 'parentheses or square brackets, is recursively defined as ' |
90 | 90 | 'follows.\n' |
91 | 91 | '\n' |
92 | | - '* If the target list is a single target: The object is ' |
93 | | - 'assigned to\n' |
94 | | - ' that target.\n' |
| 92 | + '* If the target list is empty: The object must also be an ' |
| 93 | + 'empty\n' |
| 94 | + ' iterable.\n' |
95 | 95 | '\n' |
96 | | - '* If the target list is a comma-separated list of targets: ' |
97 | | - 'The\n' |
98 | | - ' object must be an iterable with the same number of items as ' |
99 | | - 'there\n' |
100 | | - ' are targets in the target list, and the items are assigned, ' |
101 | | - 'from\n' |
102 | | - ' left to right, to the corresponding targets.\n' |
| 96 | + '* If the target list is a single target in parentheses: The ' |
| 97 | + 'object\n' |
| 98 | + ' is assigned to that target.\n' |
103 | 99 | '\n' |
104 | | - ' * If the target list contains one target prefixed with an\n' |
105 | | - ' asterisk, called a "starred" target: The object must be a ' |
106 | | - 'sequence\n' |
107 | | - ' with at least as many items as there are targets in the ' |
| 100 | + '* If the target list is a comma-separated list of targets, or ' |
| 101 | + 'a\n' |
| 102 | + ' single target in square brackets: The object must be an ' |
| 103 | + 'iterable\n' |
| 104 | + ' with the same number of items as there are targets in the ' |
108 | 105 | 'target\n' |
109 | | - ' list, minus one. The first items of the sequence are ' |
110 | | - 'assigned,\n' |
111 | | - ' from left to right, to the targets before the starred ' |
112 | | - 'target. The\n' |
113 | | - ' final items of the sequence are assigned to the targets ' |
114 | | - 'after the\n' |
115 | | - ' starred target. A list of the remaining items in the ' |
116 | | - 'sequence is\n' |
117 | | - ' then assigned to the starred target (the list can be ' |
118 | | - 'empty).\n' |
| 106 | + ' list, and the items are assigned, from left to right, to ' |
| 107 | + 'the\n' |
| 108 | + ' corresponding targets.\n' |
119 | 109 | '\n' |
120 | | - ' * Else: The object must be a sequence with the same number ' |
| 110 | + ' * If the target list contains one target prefixed with an\n' |
| 111 | + ' asterisk, called a "starred" target: The object must be ' |
| 112 | + 'an\n' |
| 113 | + ' iterable with at least as many items as there are targets ' |
| 114 | + 'in the\n' |
| 115 | + ' target list, minus one. The first items of the iterable ' |
| 116 | + 'are\n' |
| 117 | + ' assigned, from left to right, to the targets before the ' |
| 118 | + 'starred\n' |
| 119 | + ' target. The final items of the iterable are assigned to ' |
| 120 | + 'the\n' |
| 121 | + ' targets after the starred target. A list of the remaining ' |
| 122 | + 'items\n' |
| 123 | + ' in the iterable is then assigned to the starred target ' |
| 124 | + '(the list\n' |
| 125 | + ' can be empty).\n' |
| 126 | + '\n' |
| 127 | + ' * Else: The object must be an iterable with the same number ' |
121 | 128 | 'of\n' |
122 | 129 | ' items as there are targets in the target list, and the ' |
123 | 130 | 'items are\n' |
|
149 | 156 | 'destructor (if it\n' |
150 | 157 | ' has one) to be called.\n' |
151 | 158 | '\n' |
152 | | - '* If the target is a target list enclosed in parentheses or ' |
153 | | - 'in\n' |
154 | | - ' square brackets: The object must be an iterable with the ' |
155 | | - 'same number\n' |
156 | | - ' of items as there are targets in the target list, and its ' |
157 | | - 'items are\n' |
158 | | - ' assigned, from left to right, to the corresponding targets.\n' |
159 | | - '\n' |
160 | 159 | '* If the target is an attribute reference: The primary ' |
161 | 160 | 'expression in\n' |
162 | 161 | ' the reference is evaluated. It should yield an object with\n' |
|
1148 | 1147 | ' call ::= primary "(" [argument_list [","] | ' |
1149 | 1148 | 'comprehension] ")"\n' |
1150 | 1149 | ' argument_list ::= positional_arguments ["," ' |
1151 | | - 'keyword_arguments]\n' |
1152 | | - ' ["," "*" expression] ["," ' |
1153 | | - 'keyword_arguments]\n' |
1154 | | - ' ["," "**" expression]\n' |
1155 | | - ' | keyword_arguments ["," "*" expression]\n' |
1156 | | - ' ["," keyword_arguments] ["," "**" ' |
1157 | | - 'expression]\n' |
1158 | | - ' | "*" expression ["," keyword_arguments] ["," ' |
1159 | | - '"**" expression]\n' |
1160 | | - ' | "**" expression\n' |
1161 | | - ' positional_arguments ::= expression ("," expression)*\n' |
1162 | | - ' keyword_arguments ::= keyword_item ("," keyword_item)*\n' |
| 1150 | + 'starred_and_keywords]\n' |
| 1151 | + ' ["," keywords_arguments]\n' |
| 1152 | + ' | starred_and_keywords ["," ' |
| 1153 | + 'keywords_arguments]\n' |
| 1154 | + ' | keywords_arguments\n' |
| 1155 | + ' positional_arguments ::= ["*"] expression ("," ["*"] ' |
| 1156 | + 'expression)*\n' |
| 1157 | + ' starred_and_keywords ::= ("*" expression | keyword_item)\n' |
| 1158 | + ' ("," "*" expression | "," ' |
| 1159 | + 'keyword_item)*\n' |
| 1160 | + ' keywords_arguments ::= (keyword_item | "**" expression)\n' |
| 1161 | + ' ("," keyword_item | "**" expression)*\n' |
1163 | 1162 | ' keyword_item ::= identifier "=" expression\n' |
1164 | 1163 | '\n' |
1165 | 1164 | 'An optional trailing comma may be present after the positional and\n' |
|
1235 | 1234 | '\n' |
1236 | 1235 | 'If the syntax "*expression" appears in the function call, ' |
1237 | 1236 | '"expression"\n' |
1238 | | - 'must evaluate to an iterable. Elements from this iterable are ' |
1239 | | - 'treated\n' |
1240 | | - 'as if they were additional positional arguments; if there are\n' |
1241 | | - 'positional arguments *x1*, ..., *xN*, and "expression" evaluates to ' |
1242 | | - 'a\n' |
1243 | | - 'sequence *y1*, ..., *yM*, this is equivalent to a call with M+N\n' |
1244 | | - 'positional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n' |
| 1237 | + 'must evaluate to an *iterable*. Elements from these iterables are\n' |
| 1238 | + 'treated as if they were additional positional arguments. For the ' |
| 1239 | + 'call\n' |
| 1240 | + '"f(x1, x2, *y, x3, x4)", if *y* evaluates to a sequence *y1*, ...,\n' |
| 1241 | + '*yM*, this is equivalent to a call with M+4 positional arguments ' |
| 1242 | + '*x1*,\n' |
| 1243 | + '*x2*, *y1*, ..., *yM*, *x3*, *x4*.\n' |
1245 | 1244 | '\n' |
1246 | 1245 | 'A consequence of this is that although the "*expression" syntax ' |
1247 | 1246 | 'may\n' |
1248 | | - 'appear *after* some keyword arguments, it is processed *before* ' |
1249 | | - 'the\n' |
1250 | | - 'keyword arguments (and the "**expression" argument, if any -- see\n' |
1251 | | - 'below). So:\n' |
| 1247 | + 'appear *after* explicit keyword arguments, it is processed ' |
| 1248 | + '*before*\n' |
| 1249 | + 'the keyword arguments (and any "**expression" arguments -- see ' |
| 1250 | + 'below).\n' |
| 1251 | + 'So:\n' |
1252 | 1252 | '\n' |
1253 | 1253 | ' >>> def f(a, b):\n' |
1254 | 1254 | ' ... print(a, b)\n' |
|
1269 | 1269 | 'arise.\n' |
1270 | 1270 | '\n' |
1271 | 1271 | 'If the syntax "**expression" appears in the function call,\n' |
1272 | | - '"expression" must evaluate to a mapping, the contents of which are\n' |
1273 | | - 'treated as additional keyword arguments. In the case of a keyword\n' |
1274 | | - 'appearing in both "expression" and as an explicit keyword argument, ' |
1275 | | - 'a\n' |
1276 | | - '"TypeError" exception is raised.\n' |
| 1272 | + '"expression" must evaluate to a *mapping*, the contents of which ' |
| 1273 | + 'are\n' |
| 1274 | + 'treated as additional keyword arguments. If a keyword is already\n' |
| 1275 | + 'present (as an explicit keyword argument, or from another ' |
| 1276 | + 'unpacking),\n' |
| 1277 | + 'a "TypeError" exception is raised.\n' |
1277 | 1278 | '\n' |
1278 | 1279 | 'Formal parameters using the syntax "*identifier" or "**identifier"\n' |
1279 | 1280 | 'cannot be used as positional argument slots or as keyword argument\n' |
1280 | 1281 | 'names.\n' |
1281 | 1282 | '\n' |
| 1283 | + 'Changed in version 3.5: Function calls accept any number of "*" ' |
| 1284 | + 'and\n' |
| 1285 | + '"**" unpackings, positional arguments may follow iterable ' |
| 1286 | + 'unpackings\n' |
| 1287 | + '("*"), and keyword arguments may follow dictionary unpackings ' |
| 1288 | + '("**").\n' |
| 1289 | + 'Originally proposed by **PEP 448**.\n' |
| 1290 | + '\n' |
1282 | 1291 | 'A call always returns some value, possibly "None", unless it raises ' |
1283 | 1292 | 'an\n' |
1284 | 1293 | 'exception. How this value is computed depends on the type of the\n' |
|
1324 | 1333 | '\n' |
1325 | 1334 | ' classdef ::= [decorators] "class" classname [inheritance] ":" ' |
1326 | 1335 | 'suite\n' |
1327 | | - ' inheritance ::= "(" [parameter_list] ")"\n' |
| 1336 | + ' inheritance ::= "(" [argument_list] ")"\n' |
1328 | 1337 | ' classname ::= identifier\n' |
1329 | 1338 | '\n' |
1330 | 1339 | 'A class definition is an executable statement. The inheritance ' |
|
2261 | 2270 | '[parameter_list] ")" ["->" expression] ":" suite\n' |
2262 | 2271 | ' decorators ::= decorator+\n' |
2263 | 2272 | ' decorator ::= "@" dotted_name ["(" ' |
2264 | | - '[parameter_list [","]] ")"] NEWLINE\n' |
| 2273 | + '[argument_list [","]] ")"] NEWLINE\n' |
2265 | 2274 | ' dotted_name ::= identifier ("." identifier)*\n' |
2266 | 2275 | ' parameter_list ::= defparameter ("," defparameter)* ' |
2267 | 2276 | '["," [parameter_list_starargs]]\n' |
|
2426 | 2435 | '\n' |
2427 | 2436 | ' classdef ::= [decorators] "class" classname [inheritance] ' |
2428 | 2437 | '":" suite\n' |
2429 | | - ' inheritance ::= "(" [parameter_list] ")"\n' |
| 2438 | + ' inheritance ::= "(" [argument_list] ")"\n' |
2430 | 2439 | ' classname ::= identifier\n' |
2431 | 2440 | '\n' |
2432 | 2441 | 'A class definition is an executable statement. The inheritance ' |
|
2563 | 2572 | 'Is semantically equivalent to:\n' |
2564 | 2573 | '\n' |
2565 | 2574 | ' iter = (ITER)\n' |
2566 | | - ' iter = await type(iter).__aiter__(iter)\n' |
| 2575 | + ' iter = type(iter).__aiter__(iter)\n' |
2567 | 2576 | ' running = True\n' |
2568 | 2577 | ' while running:\n' |
2569 | 2578 | ' try:\n' |
|
3889 | 3898 | ' dict_display ::= "{" [key_datum_list | dict_comprehension] ' |
3890 | 3899 | '"}"\n' |
3891 | 3900 | ' key_datum_list ::= key_datum ("," key_datum)* [","]\n' |
3892 | | - ' key_datum ::= expression ":" expression\n' |
| 3901 | + ' key_datum ::= expression ":" expression | "**" or_expr\n' |
3893 | 3902 | ' dict_comprehension ::= expression ":" expression comp_for\n' |
3894 | 3903 | '\n' |
3895 | 3904 | 'A dictionary display yields a new dictionary object.\n' |
|
3903 | 3912 | 'value\n' |
3904 | 3913 | 'for that key will be the last one given.\n' |
3905 | 3914 | '\n' |
| 3915 | + 'A double asterisk "**" denotes *dictionary unpacking*. Its operand\n' |
| 3916 | + 'must be a *mapping*. Each mapping item is added to the new\n' |
| 3917 | + 'dictionary. Later values replace values already set by earlier\n' |
| 3918 | + 'key/datum pairs and earlier dictionary unpackings.\n' |
| 3919 | + '\n' |
| 3920 | + 'New in version 3.5: Unpacking into dictionary displays, originally\n' |
| 3921 | + 'proposed by **PEP 448**.\n' |
| 3922 | + '\n' |
3906 | 3923 | 'A dict comprehension, in contrast to list and set comprehensions,\n' |
3907 | 3924 | 'needs two expressions separated with a colon followed by the usual\n' |
3908 | 3925 | '"for" and "if" clauses. When the comprehension is run, the ' |
|
4384 | 4401 | 'Expression lists\n' |
4385 | 4402 | '****************\n' |
4386 | 4403 | '\n' |
4387 | | - ' expression_list ::= expression ( "," expression )* [","]\n' |
| 4404 | + ' expression_list ::= expression ( "," expression )* [","]\n' |
| 4405 | + ' starred_list ::= starred_item ( "," starred_item )* ' |
| 4406 | + '[","]\n' |
| 4407 | + ' starred_expression ::= expression | ( starred_item "," )* ' |
| 4408 | + '[starred_item]\n' |
| 4409 | + ' starred_item ::= expression | "*" or_expr\n' |
4388 | 4410 | '\n' |
4389 | | - 'An expression list containing at least one comma yields a ' |
4390 | | - 'tuple. The\n' |
4391 | | - 'length of the tuple is the number of expressions in the list. ' |
4392 | | - 'The\n' |
4393 | | - 'expressions are evaluated from left to right.\n' |
| 4411 | + 'Except when part of a list or set display, an expression list\n' |
| 4412 | + 'containing at least one comma yields a tuple. The length of ' |
| 4413 | + 'the tuple\n' |
| 4414 | + 'is the number of expressions in the list. The expressions are\n' |
| 4415 | + 'evaluated from left to right.\n' |
| 4416 | + '\n' |
| 4417 | + 'An asterisk "*" denotes *iterable unpacking*. Its operand must ' |
| 4418 | + 'be an\n' |
| 4419 | + '*iterable*. The iterable is expanded into a sequence of items, ' |
| 4420 | + 'which\n' |
| 4421 | + 'are included in the new tuple, list, or set, at the site of ' |
| 4422 | + 'the\n' |
| 4423 | + 'unpacking.\n' |
| 4424 | + '\n' |
| 4425 | + 'New in version 3.5: Iterable unpacking in expression lists, ' |
| 4426 | + 'originally\n' |
| 4427 | + 'proposed by **PEP 448**.\n' |
4394 | 4428 | '\n' |
4395 | 4429 | 'The trailing comma is required only to create a single tuple ' |
4396 | 4430 | '(a.k.a. a\n' |
|
5220 | 5254 | '[parameter_list] ")" ["->" expression] ":" suite\n' |
5221 | 5255 | ' decorators ::= decorator+\n' |
5222 | 5256 | ' decorator ::= "@" dotted_name ["(" ' |
5223 | | - '[parameter_list [","]] ")"] NEWLINE\n' |
| 5257 | + '[argument_list [","]] ")"] NEWLINE\n' |
5224 | 5258 | ' dotted_name ::= identifier ("." identifier)*\n' |
5225 | 5259 | ' parameter_list ::= defparameter ("," defparameter)* ' |
5226 | 5260 | '["," [parameter_list_starargs]]\n' |
|
5682 | 5716 | 'the\n' |
5683 | 5717 | 'two steps are carried out separately for each clause, just as ' |
5684 | 5718 | 'though\n' |
5685 | | - 'the clauses had been separated out into individiual import ' |
| 5719 | + 'the clauses had been separated out into individual import ' |
5686 | 5720 | 'statements.\n' |
5687 | 5721 | '\n' |
5688 | 5722 | 'The details of the first step, finding and loading modules are\n' |
|
6016 | 6050 | 'in\n' |
6017 | 6051 | 'square brackets:\n' |
6018 | 6052 | '\n' |
6019 | | - ' list_display ::= "[" [expression_list | comprehension] "]"\n' |
| 6053 | + ' list_display ::= "[" [starred_list | comprehension] "]"\n' |
6020 | 6054 | '\n' |
6021 | 6055 | 'A list display yields a new list object, the contents being ' |
6022 | 6056 | 'specified\n' |
|
8305 | 8339 | 'object is bound in the local namespace as the defined ' |
8306 | 8340 | 'class.\n' |
8307 | 8341 | '\n' |
| 8342 | + 'When a new class is created by "type.__new__", the object ' |
| 8343 | + 'provided as\n' |
| 8344 | + 'the namespace parameter is copied to a standard Python ' |
| 8345 | + 'dictionary and\n' |
| 8346 | + 'the original object is discarded. The new copy becomes the ' |
| 8347 | + '"__dict__"\n' |
| 8348 | + 'attribute of the class object.\n' |
| 8349 | + '\n' |
8308 | 8350 | 'See also:\n' |
8309 | 8351 | '\n' |
8310 | 8352 | ' **PEP 3135** - New super\n' |
|
0 commit comments