[Numpy-discussion] un-silencing Numpy's deprecation warnings
numpy-discussion at maubp.freeserve.co.uk
Tue May 22 05:50:38 EDT 2012
On Tue, May 22, 2012 at 9:27 AM, Nathaniel Smith <njs at pobox.com> wrote:
> So starting in Python 2.7 and 3.2, the Python developers have made
> DeprecationWarnings invisible by default:
> The only way to see them is to explicitly request them by running
> Python with -Wd.
> The logic seems to be that between the end-of-development for 2.7 and
> the moratorium on 3.2 changes, there were a *lot* of added
> deprecations that were annoying people, and deprecations in the Python
> stdlib mean "this code is probably sub-optimal but it will still
> continue to work indefinitely". So they consider that deprecation
> warnings are like a lint tool for conscientious developers who
> remember to test their code with -Wd, but not something to bother
> users with.
> In Numpy, the majority of our users are actually (relatively
> unsophisticated) developers, and we don't plan to support deprecated
> features indefinitely. Our deprecations seem to better match what
> Python calls a "FutureWarning": "warnings about constructs that will
> change semantically in the future."
> FutureWarning is displayed by default, and available in all versions of Python.
> So maybe we should change all our DeprecationWarnings into
> FutureWarnings (or at least the ones that we actually plan to follow
> through on). Thoughts?
> - N
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).
More information about the NumPy-Discussion