Skip to content

Clarify documentation for except* #120521

@yangdanny97

Description

@yangdanny97

Documentation

The documentation for except* states

An except* clause must have a matching type, and this type cannot be a subclass of BaseExceptionGroup.

This incorrectly implies that there can only be one matching type, when tuples of types are allowed in except*.

I propose to change this to:

An except* clause must have a matching type or a tuple of matching types, which cannot be a subclass of BaseExceptionGroup.

This has been discussed in the forum: https://discuss.python.org/t/clarifying-typing-behavior-for-exception-handlers-except-except/55060

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions