[Numpy-discussion] Using 2-D arrays in Numeric Python (numpy)

Robert Kern robert.kern@gmail....
Fri Oct 10 23:02:37 CDT 2008


On Fri, Oct 10, 2008 at 21:42, Linda Seltzer
<lseltzer@alumni.caltech.edu> wrote:
> This worked:
> from numpy.oldnumeric import *

To be clear, you mean that this worked to replace the statement "from
Numeric import *" in the older code that you mentioned in your
previous thread.

> Should I use
> from numpy import *
> (Does the first statement use outdated software?)

The first statement exposes an API which is mostly compatible with the
older Numeric API. The underlying software is up-to-date, but the
interface is not.

> I want to use 2-D arrays.  Please advise me on the best way to do this.

If you are writing new code, you should use "import numpy" (as an
orthogonal note, "from <foo> import *" is discouraged). Only use
numpy.oldnumeric if you need to use old code and do not have the time
or resources to update it to use the new API.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco


More information about the Numpy-discussion mailing list