@@ -176,90 +176,102 @@ have been incorporated. Some of the most notable ones:
176
176
177
177
* Missing `` :`` before blocks:
178
178
179
- .. code- block:: python
179
+ .. code- block:: python
180
180
181
- >> > if rocket.position > event_horizon
182
- File " <stdin>" , line 1
183
- if rocket.position > event_horizon
184
- ^
185
- SyntaxError : expected ' :'
181
+ >> > if rocket.position > event_horizon
182
+ File " <stdin>" , line 1
183
+ if rocket.position > event_horizon
184
+ ^
185
+ SyntaxError : expected ' :'
186
186
187
+ (Contributed by Pablo Galindo in :issue:`42997 ` )
187
188
188
189
* Unparenthesised tuples in comprehensions targets:
189
190
190
- .. code- block:: python
191
+ .. code- block:: python
191
192
192
- >> > {x,y for x,y in range (100 )}
193
- File " <stdin>" , line 1
194
- {x,y for x,y in range (100 )}
195
- ^
196
- SyntaxError : did you forget parentheses around the comprehension target?
193
+ >> > {x,y for x,y in range (100 )}
194
+ File " <stdin>" , line 1
195
+ {x,y for x,y in range (100 )}
196
+ ^
197
+ SyntaxError : did you forget parentheses around the comprehension target?
197
198
198
- * Missing commas in collection literals:
199
+ (Contributed by Pablo Galindo in :issue: ` 43017 ` )
199
200
200
- .. code- block:: python
201
+ * Missing commas in collection literals and between expressions:
202
+
203
+ .. code- block:: python
201
204
202
- >> > items = {
203
- ... x: 1 ,
204
- ... y: 2
205
- ... z: 3 ,
206
- File " <stdin>" , line 3
207
- y: 2
208
- ^
209
- SyntaxError : invalid syntax. Perhaps you forgot a comma?
205
+ >> > items = {
206
+ ... x: 1 ,
207
+ ... y: 2
208
+ ... z: 3 ,
209
+ File " <stdin>" , line 3
210
+ y: 2
211
+ ^
212
+ SyntaxError : invalid syntax. Perhaps you forgot a comma?
213
+
214
+ (Contributed by Pablo Galindo in :issue:`43822 ` )
210
215
211
216
* Exception groups without parentheses:
212
217
213
- .. code- block:: python
218
+ .. code- block:: python
214
219
215
- >> > try :
216
- ... build_dyson_sphere()
217
- ... except NotEnoughScienceError, NotEnoughResourcesError:
218
- File " <stdin>" , line 3
219
- except NotEnoughScienceError, NotEnoughResourcesError:
220
- ^
221
- SyntaxError : exception group must be parenthesized
220
+ >> > try :
221
+ ... build_dyson_sphere()
222
+ ... except NotEnoughScienceError, NotEnoughResourcesError:
223
+ File " <stdin>" , line 3
224
+ except NotEnoughScienceError, NotEnoughResourcesError:
225
+ ^
226
+ SyntaxError : exception group must be parenthesized
227
+
228
+ (Contributed by Pablo Galindo in :issue:`43149 ` )
222
229
223
230
* Missing `` :`` and values in dictionary literals:
224
231
225
- .. code- block:: python
232
+ .. code- block:: python
233
+
234
+ >> > values = {
235
+ ... x: 1 ,
236
+ ... y: 2 ,
237
+ ... z:
238
+ ... }
239
+ File " <stdin>" , line 4
240
+ z:
241
+ ^
242
+ SyntaxError : expression expected after dictionary key and ' :'
226
243
227
- >> > values = {
228
- ... x: 1 ,
229
- ... y: 2 ,
230
- ... z:
231
- ... }
232
- File " <stdin>" , line 4
233
- z:
234
- ^
235
- SyntaxError : expression expected after dictionary key and ' :'
236
-
237
- >> > values = {x:1 , y:2 , z w:3 }
238
- File " <stdin>" , line 1
239
- values = {x:1 , y:2 , z w:3 }
240
- ^
241
- SyntaxError : ' :' expected after dictionary key
244
+ >> > values = {x:1 , y:2 , z w:3 }
245
+ File " <stdin>" , line 1
246
+ values = {x:1 , y:2 , z w:3 }
247
+ ^
248
+ SyntaxError : ' :' expected after dictionary key
249
+
250
+ (Contributed by Pablo Galindo in :issue:`43823 ` )
242
251
243
252
* Usage of `` =`` instead of `` == `` in comparisons:
244
253
245
- .. code- block:: python
254
+ .. code- block:: python
246
255
247
- >> > if rocket.position = event_horizon:
248
- File " <stdin>" , line 1
249
- if rocket.position = event_horizon:
250
- ^
251
- SyntaxError : cannot assign to attribute here. Maybe you meant ' ==' instead of ' =' ?
256
+ >> > if rocket.position = event_horizon:
257
+ File " <stdin>" , line 1
258
+ if rocket.position = event_horizon:
259
+ ^
260
+ SyntaxError : cannot assign to attribute here. Maybe you meant ' ==' instead of ' =' ?
261
+
262
+ (Contributed by Pablo Galindo in :issue:`43797 ` )
252
263
253
264
* Usage of `` * `` in f- strings:
254
265
255
- .. code- block:: python
266
+ .. code- block:: python
256
267
257
- >> > f " Black holes { * all_black_holes} and revelations "
258
- File " <stdin>" , line 1
259
- (* all_black_holes)
260
- ^
261
- SyntaxError : f- string: cannot use starred expression here
268
+ >> > f " Black holes { * all_black_holes} and revelations "
269
+ File " <stdin>" , line 1
270
+ (* all_black_holes)
271
+ ^
272
+ SyntaxError : f- string: cannot use starred expression here
262
273
274
+ (Contributed by Pablo Galindo in :issue:`41064 ` )
263
275
264
276
AttributeErrors
265
277
~~~~~~~~~~~~~~~
0 commit comments