On this page
builtins.DeprecationWarning
Prev: builtins.delattr | Up: builtins | Next: builtins.dir
Rel: builtins.abs, builtins.aiter, builtins.all, builtins.anext
Ref: docs.python.org โ builtins.DeprecationWarning
Tags: #public #python3 #stdlib #builtins
Import
import builtins
from builtins import DeprecationWarning
Signature & Overview
builtins.DeprecationWarning(...)
Base class for warnings about deprecated features.
Methods & Attributes
DeprecationWarning.add_note(self, note, /)โ Add a note to the exceptionDeprecationWarning.with_traceback(self, tb, /)โ Set self.traceback to tb and return self.
Usage
import warnings
with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter("always")
warnings.warn("use new_fn", DeprecationWarning)
assert len(caught) == 1
Gotchas
- Hidden by default outside
__main__: Run tests withpython3 -W defaultorpytestto surface deprecations early.
REPL Inspect
from builtins import DeprecationWarning
help(DeprecationWarning)
Linked from
Related notes
- tuts/python3/stdlib_module/builtins/delattr Linked here; links to this page; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/dir Linked here; links to this page; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/builtins/abs Linked here; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/aiter Linked here; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/all Linked here; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/anext Linked here; shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/any shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/ArithmeticError shared tags: #builtins, #stdlib
- tuts/python3/stdlib_module/builtins/ascii shared tags: #builtins, #stdlib