~/talk

When is an exception not an exception? Using warnings in Python

Talkat PyCon US 2021 · 2021-05-14..05-15· [python]
slides:none on file

Shows concrete APIs and behaviors: uses warnings.warn with categories and stacklevel to point to the caller, explains built-in categories and why deprecation warnings are ignored by default, demos command-line -W / PYTHONWARNINGS to alter actions (always, ignore, error) and why custom warning classes require runtime filters, walks through warnings.filterwarnings and the catch_warnings context manager, and gives real examples (pandas SettingWithCopy and deprecation transition) so it’s practical rather than conceptual.

AI-written summary · about

  1. 0:00Introduction to warnings
  2. 2:20History and purpose
  3. 3:51Warnings vs exceptions
  4. 6:11How to use warnings
  5. 9:15Planning for change
  6. 10:33Warning categories
  7. 12:35Filtering warnings
  8. 15:32Advanced filtering options
  9. 19:17Controlling in code
  10. 21:06Best practices and examples
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.