[Numpy-discussion] Re: [SciPy-dev] matrix and ravel()

Chris Barker Chris.Barker at noaa.gov
Wed Oct 12 18:15:58 CDT 2005


Travis Oliphant wrote:
> In particular, here are two proposals.
> 1) current behavior
> array (and asarray) --- returns the object itself if it is a sub-class 
> of the array
>                                      (or an array scalar).
> asndarray ---  returns an actual nd array object

-1. I expect as array to return an array. Period. That's why I use it.

> 2) new behavior
> 
> array (and asarray)  always return an ndarray base-class object (or a 
> big-nd array if the object is already one).

+1 ...I think. What is a big-nd array?

> asanyarray ---  returns an nd-array or a sub-class if the object is 
> already a sub-class.

What about having each subclass define it's own function-- asmatrix, 
etc? Maybe that's not general enough, but I know I use asarray because I 
know I want a NumPy Array, and nothing else.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception




More information about the Numpy-discussion mailing list