Nick Coghlan <ncogh...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32229>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to