On 02/09/2021 11:41, Chris Angelico wrote:
On Thu, Sep 2, 2021 at 7:36 PM Peter Otten <__peter__@web.de> wrote:
On 02/09/2021 04:32, Steven D'Aprano wrote:
On Wed, Sep 01, 2021 at 03:40:37PM +0200, Peter Otten wrote:
Instead of removing it you might add a filter to get a similar effect:
[...]
> warnings.filterwarnings("always", "woof!")
Unfortunately that's too aggressive. In my use-case, `bark` will be called many, many times in a loop, and so potentially "woof" will be displayed over and over again. That will be annoying.
Then use filterwarnings("once", ...):
That has the side effect that all OTHER warnings get their onceness reset too though.
Oops, insufficient testing. But I really didn't expect that...
(It's actually the same as resetfilters, and for the same reason - whenever the filters change, all oncenesses get forgotten.)
Could be changed (I'm tempted to say fixed)?