[Numpy-discussion] fread codes versus numpy types

David M. Cooke cookedm at physics.mcmaster.ca
Wed Jun 28 14:53:56 EDT 2006


On Wed, 28 Jun 2006 11:22:38 -0600
"Fernando Perez" <fperez.net at gmail.com> wrote:

> On 6/28/06, Robert Kern <robert.kern at gmail.com> wrote:
> 
> > The Capitalized versions are actually old typecodes for backwards
> > compatibility with Numeric. In recent development versions of numpy, they
> > are no longer exposed except through the numpy.oldnumeric compatibility
> > module. A decision was made for numpy to use the actual width of a type
> > in its name instead of the width of its component parts (when it has
> > parts).
> >
> > Code in scipy which still requires actual string typecodes is a bug.
> > Please report such cases on the Trac:
> >
> >    http://projects.scipy.org/scipy/scipy
> 
> Well, an easy way to make all those poke their ugly heads in a hurry
> would be to remove line 32 in scipy's init:
> 
> longs[Lib]> grep -n oldnum *py
> __init__.py:31:import numpy.oldnumeric as _num
> __init__.py:32:from numpy.oldnumeric import *
> 
> 
> If we really want to push for the new api, I think it's fair to change
> those two lines by simply
> 
> from numpy import oldnumeric
> 
> so that scipy also exposes oldnumeric, and let all deprecated names be
> hidden there.
> 
> I just tried this change:
> 
> Index: __init__.py
> ===================================================================
> --- __init__.py (revision 2012)
> +++ __init__.py (working copy)
> @@ -29,9 +29,8 @@
> 
>  # Import numpy symbols to scipy name space
>  import numpy.oldnumeric as _num
> -from numpy.oldnumeric import *
> -del lib
> -del linalg
> +from numpy import oldnumeric
> +
>  __all__ += _num.__all__
>  __doc__ += """
>  Contents
> 
> 
> and scipy's test suite still passes (modulo the test_cobyla thingie
> Nils is currently fixing, which is not related to this).
> 
> Should I apply this patch, so we push the cleaned-up API even a bit harder?

Yes please. I think all the modules that still use the oldnumeric names
actually import numpy.oldnumeric themselves.

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca




More information about the NumPy-Discussion mailing list