FutureWarning

Built-in ExceptionPython 2.0+Intermediate

Warning about behavior changes in future versions

Quick Info

Documentation
Official Docs
Python Version
2.0+

Learn by Difficulty

Quick Example

python
# Triggering and catching FutureWarning
try:
    import warnings; warnings.warn("future change", FutureWarning)
except FutureWarning as e:
    print(f"Caught FutureWarning: {e}")
    print(f"Type: {type(e).__name__}")

FutureWarning is raised when warning about behavior changes in future versions. Always catch specific exceptions rather than bare except clauses.

Try in Playground

Tags

exceptionerror-handlingcore