On this page
builtins.BaseExceptionGroup
Prev: builtins.BaseException | Up: builtins | Next: builtins.bin
Rel: builtins.abs, builtins.aiter, builtins.all, builtins.anext
Ref: docs.python.org — builtins.BaseExceptionGroup
Tags: #public #python3 #stdlib #builtins
Import
import builtins
from builtins import BaseExceptionGroup
Signature & Overview
builtins.BaseExceptionGroup(...)
A combination of multiple unrelated exceptions.
Methods & Attributes
BaseExceptionGroup.add_note(self, note, /)— Add a note to the exceptionBaseExceptionGroup.derive(self, excs, /)—BaseExceptionGroup.derivemethod/property.BaseExceptionGroup.split(self, matcher_value, /)—BaseExceptionGroup.splitmethod/property.BaseExceptionGroup.subgroup(self, matcher_value, /)—BaseExceptionGroup.subgroupmethod/property.BaseExceptionGroup.with_traceback(self, tb, /)— Set self.traceback to tb and return self.
Usage
eg = BaseExceptionGroup("errors", [ValueError("bad"), KeyError("k")])
assert len(eg.exceptions) == 2
Gotchas
- Requires Python 3.11+ (PEP 654): Handle groups cleanly with
except* ValueError:rather than plainexcept:.
REPL Inspect
from builtins import BaseExceptionGroup
help(BaseExceptionGroup)
Linked from
Related notes
- tuts/python3/stdlib_module/builtins/BaseException Linked here; links to this page; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/bin Linked here; links to this page; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/builtins/abs Linked here; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/aiter Linked here; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/all Linked here; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/anext Linked here; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/any shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/ArithmeticError shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/ascii shared tags: #builtins, #stdlib