Exception Groups in Python — ELI5

Imagine you’re a teacher grading a test. The old way: you find the first wrong answer, circle it in red, hand the test back, and the student has to fix that one before you even look at the rest. Frustrating — the student has to keep resubmitting to find all their mistakes.

Exception groups work like a better grading system. Python looks at everything, collects all the mistakes, and hands back one report that says: “Here are the three things that went wrong.”

Normally, Python stops at the first error. Something breaks, an exception is raised, and your program either handles it or crashes. That’s fine when you’re doing one thing at a time.

But modern programs often do many things at once — downloading several files, checking multiple database connections, validating a form with ten fields. If three of those tasks fail, old Python could only show you one error. The other two were hidden.

Python 3.11 introduced ExceptionGroup — a special exception that contains a collection of other exceptions bundled together. And it came with a new tool, except* (except-star), which lets you catch specific types of errors from inside the group.

Think of it like a package arriving with three items inside. The old except is like opening the package and grabbing the first thing. except* is like sorting through the package: “put the books here, the electronics there, and the food over there.”

This is especially useful for concurrent programs where multiple tasks run simultaneously and several can fail at the same time.

The one thing to remember: ExceptionGroup bundles multiple errors into one, so Python can report everything that went wrong — not just the first problem.

pythonerror-handlingpython311

See Also

  • Python 310 New Features Python 3.10 gave programmers a shape-sorting machine, friendlier error messages, and cleaner ways to say 'this or that' in type hints.
  • Python 311 New Features Python 3.11 made everything faster, error messages smarter, and let you catch several mistakes at once instead of stopping at the first one.
  • Python 312 New Features Python 3.12 made type hints shorter, f-strings more powerful, and started preparing Python's engine for a world without the GIL.
  • Python 313 New Features Python 3.13 finally lets multiple tasks run at the same time for real, added a speed booster engine, and gave the interactive prompt a colourful makeover.
  • Python Free Threading Nogil Python has always had a rule that only one thing can happen at a time — free threading finally changes that, like opening extra checkout lanes at the grocery store.