[ python-Feature Requests-1214675 ] module warnings lacks a remove filter function

SourceForge.net noreply at sourceforge.net
Mon Jun 27 06:22:29 CEST 2005


Feature Requests item #1214675, was opened at 2005-06-04 02:37
Message generated for change (Comment added) made by rhettinger
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1214675&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Torsten Bronger (bronger)
Assigned to: Nobody/Anonymous (nobody)
Summary: module warnings lacks a remove filter function

Initial Comment:
In the module warnings, there is no function for
removing certain items from the list of warnings
filters.  The only options are to empty the list
completely or to manipulate the warnings.filters list
directly, both of which is unfortunate in my opinion.

I attached a file with a removefilter() function.  I
don't know how safe it is to complete regular
expressions, however, it works nicely for me.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2005-06-26 23:22

Message:
Logged In: YES 
user_id=80475

I'm concerned that removefilter() may not work well in the 
presence of multiple modules that use the warnings module.  It 
may be difficult to make sure the one removed wasn't 
subsequently added another module.  Also, the issue is 
compounded because the order of filter application is important.

----------------------------------------------------------------------

Comment By: Michael Hudson (mwh)
Date: 2005-06-04 07:48

Message:
Logged In: YES 
user_id=6656

Pfft, this isn't Java!

I'm not sure it should be done with impunity, but as a documented 
interface it makes perfect sense to me.

----------------------------------------------------------------------

Comment By: Torsten Bronger (bronger)
Date: 2005-06-04 05:35

Message:
Logged In: YES 
user_id=442234

It's simpler of course.  However, if it's relatively easy to
avoid, a module user should not manipulate module data
structures directly, I think.

----------------------------------------------------------------------

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-06-04 04:33

Message:
Logged In: YES 
user_id=1188172

I don't know, but wouldn't it be simpler to just document
the warnings.filters attribute so that people know how to
manipulate the list of filters?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1214675&group_id=5470


More information about the Python-bugs-list mailing list