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

Nathaniel Smith njs at pobox.com
Tue May 22 04:27:31 EDT 2012


So starting in Python 2.7 and 3.2, the Python developers have made
DeprecationWarnings invisible by default:
  http://docs.python.org/whatsnew/2.7.html#the-future-for-python-2-x
  http://mail.python.org/pipermail/stdlib-sig/2009-November/000789.html
  http://bugs.python.org/issue7319
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."
  http://docs.python.org/library/warnings.html#warning-categories
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



More information about the NumPy-Discussion mailing list