[Numpy-discussion] un-silencing Numpy's deprecation warnings

Jonathan T. Niehof jniehof at lanl.gov
Tue May 22 10:39:53 EDT 2012


On 05/22/2012 03:50 AM, Peter wrote:
> We had the same discussion for Biopython two years ago, and
> introduced our own warning class to avoid our deprecations being
> silent (and thus almost pointless). It is just a subclass of Warning
> (originally we used a subclass of UserWarning).

For SpacePy we took a similar but slightly different approach; this is 
in the top-level __init__:
if config['enable_deprecation_warning']:
     warnings.filterwarnings('default', '', DeprecationWarning,
                             '^spacepy', 0, False)
enable_deprecation_warning is True by default, but can be changed in the 
user's config file. This keeps everything as DeprecationWarning but only 
fiddles with the filter for spacepy (and it's set to default, not always.)

-- 
Jonathan Niehof
ISR-3 Space Data Systems
Los Alamos National Laboratory
MS-D466
Los Alamos, NM 87545

Phone: 505-667-9595
email: jniehof at lanl.gov

Correspondence /
Technical data or Software Publicly Available



More information about the NumPy-Discussion mailing list