Slide 32
Slide 32 text
Reuven M. Lerner • PyCon 2021 @reuvenmlerner • https://lerner.co.il
Warning actions
• When Python encounters a warning, it can take one of six actions:
• “default” — what we’ve seen, namely print a warning once per
combination of module + line number
• “error” — raise an exception
• “ignore” — ignore the warning
• “always” — always print, even if it’s the same warning, from the same
line of code
• “module” — only print once per module, regardless of line number
• “once” — only print once, no matter where the warning was raised
32