IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
26.4.1 Warning Categories


26.4.1 Warning Categories

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.
FutureWarning Base category for warnings about constructs that will change semantically in the future.
PendingDeprecationWarning Base category for warnings about features that will be deprecated in the future (ignored by default).
ImportWarning Base category for warnings triggered during the process of importing a module (ignored by default).
UnicodeWarning Base category for warnings related to Unicode.

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.