[SciPy-dev] [Numpy-discussion] Re: numpy/scipy some remarks

Robert Kern robert.kern at gmail.com
Wed Jan 18 14:05:54 CST 2006


Fernando Perez wrote:
> Travis Oliphant wrote:
> 
>>>3) pkgload() exists to support the loading of subpackages. It does not reach
>>>into numpy.dft or numpy.linalg at all. It is not relevant to this issue.
>>>
>>>4) There are some places in numpy that use numpy.dual.
>>>
>>>I think we can address all of your concerns by changing #4.
>>
>>This is an accurate assessment.  However,  I do not want to eliminate 
>>number 4 as I've mentioned before.   I think there is a place for having 
>>functions that can be over-written with better versions.   I agree that 
>>it could be implemented better, however, with some kind of register 
>>function instead of automatically looking in scipy...
> 
> Mmh, I think I'm confused then:

So am I, now!

> it seemed to me that pkgload() WAS overwriting 
> numpy names, from the messages which the environment variable controls.  Is 
> that not true?  Here's a recent thread:
> 
> http://aspn.activestate.com/ASPN/Mail/Message/scipy-dev/2974044
> 
> where this was shown:
> 
> In [3]: import scipy
> Overwriting fft=<function fft at 0x2000000001474668>  from
> scipy.fftpack.basic (was <function fft at 0x2000000001394a28>  from
> numpy.dft.fftpack)
> Overwriting ifft=<function ifft at 0x20000000014746e0>  from
> scipy.fftpack.basic (was <function inverse_fft at 0x2000000001394aa0>  from
> numpy.dft.fftpack)

[~]$ python
Python 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
scipy.>>> scipy.pkgload(verbose=2)
Imports to 'scipy' namespace
----------------------------
__all__.append('io')
import lib -> success
Overwriting lib=<module 'scipy.lib' from
'/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy-0.4.4.1307-py2.4-macosx-10.4-ppc.egg/scipy/lib/__init__.pyc'>
from
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy-0.4.4.1307-py2.4-macosx-10.4-ppc.egg/scipy/lib/__init__.pyc
(was <module 'numpy.lib' from
'/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/numpy-0.9.4.1849-py2.4-macosx-10.4-ppc.egg/numpy/lib/__init__.pyc'>
from
/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/numpy-0.9.4.1849-py2.4-macosx-10.4-ppc.egg/numpy/lib/__init__.pyc)
__all__.append('signal')
__all__.append('interpolate')
__all__.append('lib.lapack')
import cluster -> success
__all__.append('montecarlo')
__all__.append('fftpack')
__all__.append('sparse')
__all__.append('integrate')
__all__.append('optimize')
__all__.append('special')
import lib.blas -> success
__all__.append('linalg')
__all__.append('stats')
>>> import numpy
>>> numpy.lib
<module 'numpy.lib' from
'/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/numpy-0.9.4.1849-py2.4-macosx-10.4-ppc.egg/numpy/lib/__init__.pyc'>
>>> scipy.lib
<module 'scipy.lib' from
'/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/scipy-0.4.4.1307-py2.4-macosx-10.4-ppc.egg/scipy/lib/__init__.pyc'>

[Ignore the SVN version numbers. They are faked. I was using checkouts from last
night.]

> I understood this as 'scipy.fftpack.basic.fft overwrote 
> numpy.dft.fftpack.fft'.  Does this then not affect the numpy namespace at all?

If it does, then I agree with you that this should change.

> I also would like to propose that, rather than using an environment variable, 
> pkgload() takes a 'verbose=' keyword (or 'quiet=').  I think it's much cleaner 
> to say
> 
> pkgload(quiet=1) or pkgload(verbose=0)
> 
> than relying on users configuring env. variables for something like this.

It does take a verbose keyword argument.

-- 
Robert Kern
robert.kern at gmail.com

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter




More information about the Scipy-dev mailing list