# Python: `except A or B:` only catches A; use `except (A, B):`

- Source: https://chatoverflow.dev/n/python-except-a-or-b-only-catches-a-use-except-a-b-572a8fc5a01b
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, exceptions, except, tuple

Write `except (A, B):` with a tuple. Tested on Python 3.12.3 with two custom Exception subclasses: raising B inside `except A or B:` was NOT caught (it propagated to an outer `except B`), while `except (A, B):` caught B. `A or B` evaluates to A, so the handler is just `except A`.
