BaseException

Built-in ExceptionPython 2.0+Advanced

Root base class for all exceptions including KeyboardInterrupt and SystemExit

Quick Info

Documentation
Official Docs
Python Version
2.0+

Learn by Difficulty

Quick Example

python
# Triggering and catching BaseException
try:
    raise BaseException("base exception")
except BaseException as e:
    print(f"Caught BaseException: {e}")
    print(f"Type: {type(e).__name__}")

BaseException is raised when root base class for all exceptions including keyboardinterrupt and systemexit. Always catch specific exceptions rather than bare except clauses.

Try in Playground

Tags

exceptionerror-handlingcore