Skip to content

Commit 49b41b7

Browse files
committed
gh-129902: move code example from blurb_it to whatsnew rst.
1 parent bf777a2 commit 49b41b7

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

Doc/whatsnew/3.14.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,22 @@ Improved error messages
174174
^^^^^^^
175175
ValueError: too many values to unpack (expected 3, got 4)
176176
177+
* `elif` statements that follow an `else` block now have a specific error message.
178+
(Contributed by Steele Farnsworth in :gh:`129902`.)
179+
180+
.. code-block:: pycon
181+
182+
>>> if who == "me":
183+
... print("It's me!")
184+
... else:
185+
... print("It's not me!")
186+
... elif who is None:
187+
... print("Who is it?")
188+
File "<stdin>", line 5
189+
elif who is None:
190+
^^^^
191+
SyntaxError: 'elif' block follows an 'else' block
192+
177193
178194
.. _whatsnew314-pep741:
179195

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1 @@
1-
`elif` statements that follow an `else` block now have a specific error message.
2-
```py
3-
>>> if who == "me":
4-
... print("It's me!")
5-
... else:
6-
... print("It's not me!")
7-
... elif who is None:
8-
... print("Who is it?")
9-
File "<stdin>", line 5
10-
elif who is None:
11-
^^^^
12-
SyntaxError: 'elif' block follows an 'else' block
13-
```
1+
`elif` statements that follow an `else` block now have a specific error message.

0 commit comments

Comments
 (0)