There are a number of built-in exceptions that represent warning categories. This categorization is useful to be able to filter out groups of warnings. The following warnings category classes are currently defined:
Class | Description |
---|---|
Warning | This is the base class of all warning category classes. It is a subclass of Exception. |
UserWarning | The default category for warn(). |
DeprecationWarning | Base category for warnings about deprecated features. |
SyntaxWarning | Base category for warnings about dubious syntactic features. |
RuntimeWarning | Base category for warnings about dubious runtime features. |
While these are technically built-in exceptions, they are documented here, because conceptually they belong to the warnings mechanism.
User code can define additional warning categories by subclassing one of the standard warning categories. A warning category must always be a subclass of the Warning class.
See About this document... for information on suggesting changes.