python runtime services warnings the warnings module provides functions to issue and filter warning messages unlike exceptionswarnings are intended to alert the user to potential problemsbut without generating an exception or causing execution to stop one of the primary uses of the warnings module is to inform users about deprecated language features that may not be supported in future versions of python for exampleimport regex _main_ : deprecationwarningthe regex module is deprecatedmodule use the re like exceptionswarnings are organized into class hierarchy that describes general categories of warnings the following lists the currently supported categorieswarning object description warning userwarning deprecationwarning syntaxwarning runtimewarning futurewarning base class of all warning types user-defined warning warning for use of deprecated feature potential syntax problem potential runtime problem warning that the semantics of particular feature will change in future release each of these classes is available in the _builtin_ module as well as the exceptions module in additionthey are also instances of exception this makes it possible to easily convert warnings into errors warnings are issued using the warn(function for examplewarnings warn("feature is deprecated "warnings warn("feature might be broken "runtimewarningif desiredwarnings can be filtered the filtering process can be used to alter the output behavior of warning messagesto ignore warningsor to turn warnings into exceptions the filterwarnings(function is used to add filter for specific type of warning for examplewarnings filterwarnings(action="ignore"message=*regex *"category=deprecationwarningimport regex warning message disappears limited forms of filtering can also be specified using the - option to the interpreter for examplepython -wignore:theregex:deprecationwarning the following functions are defined in the warnings modulef lib fl ff