[SciPy-Dev] Deprecation of NumPy functions in SciPy root namespace

Eric Larson larson.eric.d at gmail.com
Mon Jun 10 16:34:52 EDT 2019


We currently import a few NumPy functions into the root SciPy namespace,
meaning you can currently do things like:

import scipy
scipy.diag(...)

However, this seems like something we shouldn't support, as people should
do the more standard `import numpy as np; np.diag(...)` instead. The
functions we currently import in scipy/__init__.py are:

from numpy import *
from numpy.random import rand, randn
from numpy.fft import fft, ifft
from numpy.lib.scimath import *

I opened a PR to deprecate these in the 1.4.0 release, marking them for
removal in 1.6.0:

https://github.com/scipy/scipy/pull/10290

Feel free to chime in if there are any objections to this plan. Ralf for
example on the PR mentioned that he was deliberating between 1.6.0 or 2.0.0
being a better target. My vote is for 1.6.0 based on how infrequently
(actually never) I have seen this pattern used in the wild, and that it
appears to have also been undocumented behavior.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20190610/3d08da39/attachment.html>


More information about the SciPy-Dev mailing list