]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
docs: fix f-string in ExceptionGroup example (#146108)
authorBartosz Grabowski <58475557+bartosz-grabowski@users.noreply.github.com>
Wed, 18 Mar 2026 16:49:15 +0000 (17:49 +0100)
committerGitHub <noreply@github.com>
Wed, 18 Mar 2026 16:49:15 +0000 (16:49 +0000)
Doc/tutorial/errors.rst

index ae21dfdbf0ac444dcb99fc73a736bb3543369455..3c6edf2c4793abd7450416aff3362cf65fd59e6d 100644 (file)
@@ -549,9 +549,9 @@ caught like any other exception. ::
    >>> try:
    ...     f()
    ... except Exception as e:
-   ...     print(f'caught {type(e)}: e')
+   ...     print(f'caught {type(e)}: {e}')
    ...
-   caught <class 'ExceptionGroup'>: e
+   caught <class 'ExceptionGroup'>: there were problems (2 sub-exceptions)
    >>>
 
 By using ``except*`` instead of ``except``, we can selectively