Message307736
Warnings aren't off by default in general - we just add implicit "ignore" filters for a few specific types.
So the primary functionality is to opt in to hiding *all* warnings, but to do it in a way that can be overridden by PYTHONWARNINGS, the interpreter's "-W" switch and the new "-X dev" mode.
For that, the usage looks like:
import warnings
warnings.hide_warnings()
Essentially, it flips the default behaviour over to "ignore everything", but reverts to the regular default if there are any config settings supplied.
The odd structure of my opening message arises from the fact that *given* such a modified default, it's then surprisingly tricky to say "hide warnings, except for those from modules I'm responsible for". That latter complication then becomes the rationale for the design of the proposed "show" parameter to carve out exceptions to the overall "hide everything" filter. |
|
Date |
User |
Action |
Args |
2017-12-06 13:21:07 | ncoghlan | set | recipients:
+ ncoghlan, r.david.murray |
2017-12-06 13:21:07 | ncoghlan | set | messageid: <1512566467.0.0.213398074469.issue32229@psf.upfronthosting.co.za> |
2017-12-06 13:21:06 | ncoghlan | link | issue32229 messages |
2017-12-06 13:21:06 | ncoghlan | create | |
|