<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>3.20.1 Warning Categories </title> <META NAME="description" CONTENT="3.20.1 Warning Categories "> <META NAME="keywords" CONTENT="lib"> <META NAME="resource-type" CONTENT="document"> <META NAME="distribution" CONTENT="global"> <meta http-equiv="Content-Type" content="text/html; charset="> <link rel="STYLESHEET" href="lib.css"> <link rel="first" href="lib.html"> <link rel="contents" href="contents.html" title="Contents"> <link rel="index" href="genindex.html" title="Index"> <LINK REL="next" href="warning-filter.html"> <LINK REL="previous" href="module-warnings.html"> <LINK REL="up" href="module-warnings.html"> <LINK REL="next" href="warning-filter.html"> </head> <body> <DIV CLASS="navigation"> <table align="center" width="100%" cellpadding="0" cellspacing="2"> <tr> <td><A href="module-warnings.html"><img src="../icons/previous.gif" border="0" height="32" alt="Previous Page" width="32"></A></td> <td><A href="module-warnings.html"><img src="../icons/up.gif" border="0" height="32" alt="Up One Level" width="32"></A></td> <td><A href="warning-filter.html"><img src="../icons/next.gif" border="0" height="32" alt="Next Page" width="32"></A></td> <td align="center" width="100%">Python Library Reference</td> <td><A href="contents.html"><img src="../icons/contents.gif" border="0" height="32" alt="Contents" width="32"></A></td> <td><a href="modindex.html" title="Module Index"><img src="../icons/modules.gif" border="0" height="32" alt="Module Index" width="32"></a></td> <td><A href="genindex.html"><img src="../icons/index.gif" border="0" height="32" alt="Index" width="32"></A></td> </tr></table> <b class="navlabel">Previous:</b> <a class="sectref" href="module-warnings.html">3.20 warnings </A> <b class="navlabel">Up:</b> <a class="sectref" href="module-warnings.html">3.20 warnings </A> <b class="navlabel">Next:</b> <a class="sectref" href="warning-filter.html">3.20.2 The Warnings Filter</A> <br><hr> </DIV> <!--End of Navigation Panel--> <H2><A NAME="SECTION0052010000000000000000"> </A> <BR> 3.20.1 Warning Categories </H2> <P> 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: <P> <table border align="center" style="border-collapse: collapse"> <thead> <tr class="tableheader"> <th align="left"><b>Class</b> </th> <th align="left"><b>Description</b> </th> </tr> </thead> <tbody valign="baseline"> <P> <tr><td align="left" valign="baseline"><tt class="exception">Warning</tt></td> <td align="left">This is the base class of all warning category classes. It is a subclass of <tt class="exception">Exception</tt>.</td><P> <tr><td align="left" valign="baseline"><tt class="exception">UserWarning</tt></td> <td align="left">The default category for <tt class="function">warn()</tt>.</td><P> <tr><td align="left" valign="baseline"><tt class="exception">DeprecationWarning</tt></td> <td align="left">Base category for warnings about deprecated features.</td><P> <tr><td align="left" valign="baseline"><tt class="exception">SyntaxWarning</tt></td> <td align="left">Base category for warnings about dubious syntactic features.</td><P> <tr><td align="left" valign="baseline"><tt class="exception">RuntimeWarning</tt></td> <td align="left">Base category for warnings about dubious runtime features.</td><P> </tbody> </table> <P> While these are technically built-in exceptions, they are documented here, because conceptually they belong to the warnings mechanism. <P> 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 <tt class="exception">Warning</tt> class. <P> <DIV CLASS="navigation"> <p><hr> <table align="center" width="100%" cellpadding="0" cellspacing="2"> <tr> <td><A href="module-warnings.html"><img src="../icons/previous.gif" border="0" height="32" alt="Previous Page" width="32"></A></td> <td><A href="module-warnings.html"><img src="../icons/up.gif" border="0" height="32" alt="Up One Level" width="32"></A></td> <td><A href="warning-filter.html"><img src="../icons/next.gif" border="0" height="32" alt="Next Page" width="32"></A></td> <td align="center" width="100%">Python Library Reference</td> <td><A href="contents.html"><img src="../icons/contents.gif" border="0" height="32" alt="Contents" width="32"></A></td> <td><a href="modindex.html" title="Module Index"><img src="../icons/modules.gif" border="0" height="32" alt="Module Index" width="32"></a></td> <td><A href="genindex.html"><img src="../icons/index.gif" border="0" height="32" alt="Index" width="32"></A></td> </tr></table> <b class="navlabel">Previous:</b> <a class="sectref" href="module-warnings.html">3.20 warnings </A> <b class="navlabel">Up:</b> <a class="sectref" href="module-warnings.html">3.20 warnings </A> <b class="navlabel">Next:</b> <a class="sectref" href="warning-filter.html">3.20.2 The Warnings Filter</A> <hr> <span class="release-info">Release 2.2, documentation updated on December 21, 2001.</span> </DIV> <!--End of Navigation Panel--> <ADDRESS> See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. </ADDRESS> </BODY> </HTML>