@@ -221,116 +221,116 @@ have been incorporated. Some of the most notable ones are as follows:
221
221
222
222
* Missing `` :`` before blocks:
223
223
224
- .. code- block:: python
224
+ .. code- block:: python
225
225
226
- >> > if rocket.position > event_horizon
227
- File " <stdin>" , line 1
228
- if rocket.position > event_horizon
229
- ^
230
- SyntaxError : expected ' :'
226
+ >> > if rocket.position > event_horizon
227
+ File " <stdin>" , line 1
228
+ if rocket.position > event_horizon
229
+ ^
230
+ SyntaxError : expected ' :'
231
231
232
- (Contributed by Pablo Galindo in :issue:`42997 ` .)
232
+ (Contributed by Pablo Galindo in :issue:`42997 ` .)
233
233
234
234
* Unparenthesised tuples in comprehensions targets:
235
235
236
- .. code- block:: python
236
+ .. code- block:: python
237
237
238
- >> > {x,y for x,y in zip (' abcd' , ' 1234' )}
239
- File " <stdin>" , line 1
240
- {x,y for x,y in zip (' abcd' , ' 1234' )}
241
- ^
242
- SyntaxError : did you forget parentheses around the comprehension target?
238
+ >> > {x,y for x,y in zip (' abcd' , ' 1234' )}
239
+ File " <stdin>" , line 1
240
+ {x,y for x,y in zip (' abcd' , ' 1234' )}
241
+ ^
242
+ SyntaxError : did you forget parentheses around the comprehension target?
243
243
244
- (Contributed by Pablo Galindo in :issue:`43017 ` .)
244
+ (Contributed by Pablo Galindo in :issue:`43017 ` .)
245
245
246
246
* Missing commas in collection literals and between expressions:
247
247
248
- .. code- block:: python
248
+ .. code- block:: python
249
249
250
- >> > items = {
251
- ... x: 1 ,
252
- ... y: 2
253
- ... z: 3 ,
254
- File " <stdin>" , line 3
255
- y: 2
256
- ^
257
- SyntaxError : invalid syntax. Perhaps you forgot a comma?
250
+ >> > items = {
251
+ ... x: 1 ,
252
+ ... y: 2
253
+ ... z: 3 ,
254
+ File " <stdin>" , line 3
255
+ y: 2
256
+ ^
257
+ SyntaxError : invalid syntax. Perhaps you forgot a comma?
258
258
259
- (Contributed by Pablo Galindo in :issue:`43822 ` .)
259
+ (Contributed by Pablo Galindo in :issue:`43822 ` .)
260
260
261
261
* Multiple Exception types without parentheses:
262
262
263
- .. code- block:: python
263
+ .. code- block:: python
264
264
265
- >> > try :
266
- ... build_dyson_sphere()
267
- ... except NotEnoughScienceError, NotEnoughResourcesError:
268
- File " <stdin>" , line 3
269
- except NotEnoughScienceError, NotEnoughResourcesError:
270
- ^
271
- SyntaxError : multiple exception types must be parenthesized
265
+ >> > try :
266
+ ... build_dyson_sphere()
267
+ ... except NotEnoughScienceError, NotEnoughResourcesError:
268
+ File " <stdin>" , line 3
269
+ except NotEnoughScienceError, NotEnoughResourcesError:
270
+ ^
271
+ SyntaxError : multiple exception types must be parenthesized
272
272
273
- (Contributed by Pablo Galindo in :issue:`43149 ` .)
273
+ (Contributed by Pablo Galindo in :issue:`43149 ` .)
274
274
275
275
* Missing `` :`` and values in dictionary literals:
276
276
277
- .. code- block:: python
277
+ .. code- block:: python
278
278
279
- >> > values = {
280
- ... x: 1 ,
281
- ... y: 2 ,
282
- ... z:
283
- ... }
284
- File " <stdin>" , line 4
285
- z:
286
- ^
287
- SyntaxError : expression expected after dictionary key and ' :'
279
+ >> > values = {
280
+ ... x: 1 ,
281
+ ... y: 2 ,
282
+ ... z:
283
+ ... }
284
+ File " <stdin>" , line 4
285
+ z:
286
+ ^
287
+ SyntaxError : expression expected after dictionary key and ' :'
288
288
289
- >> > values = {x:1 , y:2 , z w:3 }
290
- File " <stdin>" , line 1
291
- values = {x:1 , y:2 , z w:3 }
292
- ^
293
- SyntaxError : ' :' expected after dictionary key
289
+ >> > values = {x:1 , y:2 , z w:3 }
290
+ File " <stdin>" , line 1
291
+ values = {x:1 , y:2 , z w:3 }
292
+ ^
293
+ SyntaxError : ' :' expected after dictionary key
294
294
295
- (Contributed by Pablo Galindo in :issue:`43823 ` .)
295
+ (Contributed by Pablo Galindo in :issue:`43823 ` .)
296
296
297
297
* `` try `` blocks without `` except `` or `` finally `` blocks:
298
298
299
- .. code- block:: python
299
+ .. code- block:: python
300
300
301
- >> > try :
302
- ... x = 2
303
- ... something = 3
304
- File " <stdin>" , line 3
305
- something = 3
306
- ^^^^^^^^^
307
- SyntaxError : expected ' except' or ' finally' block
301
+ >> > try :
302
+ ... x = 2
303
+ ... something = 3
304
+ File " <stdin>" , line 3
305
+ something = 3
306
+ ^^^^^^^^^
307
+ SyntaxError : expected ' except' or ' finally' block
308
308
309
- (Contributed by Pablo Galindo in :issue:`44305 ` .)
309
+ (Contributed by Pablo Galindo in :issue:`44305 ` .)
310
310
311
311
* Usage of `` =`` instead of `` == `` in comparisons:
312
312
313
- .. code- block:: python
313
+ .. code- block:: python
314
314
315
- >> > if rocket.position = event_horizon:
316
- File " <stdin>" , line 1
317
- if rocket.position = event_horizon:
318
- ^
319
- SyntaxError : cannot assign to attribute here. Maybe you meant ' ==' instead of ' =' ?
315
+ >> > if rocket.position = event_horizon:
316
+ File " <stdin>" , line 1
317
+ if rocket.position = event_horizon:
318
+ ^
319
+ SyntaxError : cannot assign to attribute here. Maybe you meant ' ==' instead of ' =' ?
320
320
321
- (Contributed by Pablo Galindo in :issue:`43797 ` .)
321
+ (Contributed by Pablo Galindo in :issue:`43797 ` .)
322
322
323
323
* Usage of `` * `` in f- strings:
324
324
325
- .. code- block:: python
325
+ .. code- block:: python
326
326
327
- >> > f " Black holes { * all_black_holes} and revelations "
328
- File " <stdin>" , line 1
329
- (* all_black_holes)
330
- ^
331
- SyntaxError : f- string: cannot use starred expression here
327
+ >> > f " Black holes { * all_black_holes} and revelations "
328
+ File " <stdin>" , line 1
329
+ (* all_black_holes)
330
+ ^
331
+ SyntaxError : f- string: cannot use starred expression here
332
332
333
- (Contributed by Pablo Galindo in :issue:`41064 ` .)
333
+ (Contributed by Pablo Galindo in :issue:`41064 ` .)
334
334
335
335
IndentationErrors
336
336
~~~~~~~~~~~~~~~~~
@@ -365,10 +365,10 @@ raised from:
365
365
366
366
(Contributed by Pablo Galindo in :issue:`38530 ` .)
367
367
368
- .. warning::
369
- Notice this won' t work if :c:func:`PyErr_Display` is not called to display the error
370
- which can happen if some other custom error display function is used. This is a common
371
- scenario in some REPLs like IPython.
368
+ .. warning::
369
+ Notice this won' t work if :c:func:`PyErr_Display` is not called to display the error
370
+ which can happen if some other custom error display function is used. This is a common
371
+ scenario in some REPLs like IPython.
372
372
373
373
NameErrors
374
374
~~~~~~~~~~
@@ -387,10 +387,10 @@ was raised from:
387
387
388
388
(Contributed by Pablo Galindo in :issue:`38530 ` .)
389
389
390
- .. warning::
391
- Notice this won' t work if :c:func:`PyErr_Display` is not called to display the error,
392
- which can happen if some other custom error display function is used. This is a common
393
- scenario in some REPLs like IPython.
390
+ .. warning::
391
+ Notice this won' t work if :c:func:`PyErr_Display` is not called to display the error,
392
+ which can happen if some other custom error display function is used. This is a common
393
+ scenario in some REPLs like IPython.
394
394
395
395
396
396
PEP 626 : Precise line numbers for debugging and other tools
@@ -433,16 +433,16 @@ A match statement takes an expression and compares its value to successive
433
433
patterns given as one or more case blocks. Specifically, pattern matching
434
434
operates by:
435
435
436
- 1 . using data with type and shape (the `` subject`` )
437
- 2 . evaluating the `` subject`` in the `` match`` statement
438
- 3 . comparing the subject with each pattern in a `` case`` statement
439
- from top to bottom until a match is confirmed.
440
- 4 . executing the action associated with the pattern of the confirmed
441
- match
442
- 5 . If an exact match is not confirmed, the last case, a wildcard `` _`` ,
443
- if provided, will be used as the matching case. If an exact match is
444
- not confirmed and a wildcard case does not exist, the entire match
445
- block is a no- op.
436
+ 1 . using data with type and shape (the `` subject`` )
437
+ 2 . evaluating the `` subject`` in the `` match`` statement
438
+ 3 . comparing the subject with each pattern in a `` case`` statement
439
+ from top to bottom until a match is confirmed.
440
+ 4 . executing the action associated with the pattern of the confirmed
441
+ match
442
+ 5 . If an exact match is not confirmed, the last case, a wildcard `` _`` ,
443
+ if provided, will be used as the matching case. If an exact match is
444
+ not confirmed and a wildcard case does not exist, the entire match
445
+ block is a no- op.
446
446
447
447
Declarative approach
448
448
~~~~~~~~~~~~~~~~~~~~
@@ -2210,16 +2210,16 @@ Removed
2210
2210
* Removed `` Py_UNICODE_str* `` functions manipulating `` Py_UNICODE* `` strings.
2211
2211
(Contributed by Inada Naoki in :issue:`41123 ` .)
2212
2212
2213
- * `` Py_UNICODE_strlen`` : use :c:func:`PyUnicode_GetLength` or
2214
- :c:macro:`PyUnicode_GET_LENGTH`
2215
- * `` Py_UNICODE_strcat`` : use :c:func:`PyUnicode_CopyCharacters` or
2216
- :c:func:`PyUnicode_FromFormat`
2217
- * `` Py_UNICODE_strcpy`` , `` Py_UNICODE_strncpy`` : use
2218
- :c:func:`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`
2219
- * `` Py_UNICODE_strcmp`` : use :c:func:`PyUnicode_Compare`
2220
- * `` Py_UNICODE_strncmp`` : use :c:func:`PyUnicode_Tailmatch`
2221
- * `` Py_UNICODE_strchr`` , `` Py_UNICODE_strrchr`` : use
2222
- :c:func:`PyUnicode_FindChar`
2213
+ * `` Py_UNICODE_strlen`` : use :c:func:`PyUnicode_GetLength` or
2214
+ :c:macro:`PyUnicode_GET_LENGTH`
2215
+ * `` Py_UNICODE_strcat`` : use :c:func:`PyUnicode_CopyCharacters` or
2216
+ :c:func:`PyUnicode_FromFormat`
2217
+ * `` Py_UNICODE_strcpy`` , `` Py_UNICODE_strncpy`` : use
2218
+ :c:func:`PyUnicode_CopyCharacters` or :c:func:`PyUnicode_Substring`
2219
+ * `` Py_UNICODE_strcmp`` : use :c:func:`PyUnicode_Compare`
2220
+ * `` Py_UNICODE_strncmp`` : use :c:func:`PyUnicode_Tailmatch`
2221
+ * `` Py_UNICODE_strchr`` , `` Py_UNICODE_strrchr`` : use
2222
+ :c:func:`PyUnicode_FindChar`
2223
2223
2224
2224
* Removed `` PyUnicode_GetMax()`` . Please migrate to new (:pep:`393 ` ) APIs.
2225
2225
(Contributed by Inada Naoki in :issue:`41103 ` .)
0 commit comments