mirror of
https://github.com/python/cpython.git
synced 2025-12-23 09:19:18 +00:00
[3.14] Use a more clear example for the PEP 758 what's new section (GH-135118) (#135119)
Use a more clear example for the PEP 758 what's new section (GH-135118)
(cherry picked from commit 1f51510444)
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
parent
5b3983b1a3
commit
f5b438517d
1 changed files with 7 additions and 6 deletions
|
|
@ -342,15 +342,16 @@ For example the following expressions are now valid:
|
|||
.. code-block:: python
|
||||
|
||||
try:
|
||||
release_new_sleep_token_album()
|
||||
except AlbumNotFound, SongsTooGoodToBeReleased:
|
||||
print("Sorry, no new album this year.")
|
||||
connect_to_server()
|
||||
except TimeoutError, ConnectionRefusedError:
|
||||
print("Network issue encountered.")
|
||||
|
||||
# The same applies to except* (for exception groups):
|
||||
|
||||
try:
|
||||
release_new_sleep_token_album()
|
||||
except* AlbumNotFound, SongsTooGoodToBeReleased:
|
||||
print("Sorry, no new album this year.")
|
||||
connect_to_server()
|
||||
except* TimeoutError, ConnectionRefusedError:
|
||||
print("Network issue encountered.")
|
||||
|
||||
Check :pep:`758` for more details.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue