[Numpy-discussion] ndarray.fill and ma.array.filled

Christopher Barker Chris.Barker at noaa.gov
Thu Mar 23 11:26:16 CST 2006

Fernando Perez wrote:
> Well, but is copy/view the /only/ invariant worth guaranteeing?  I think 
> there is a valid need for functions which ensure other invariants, such 
> as contiguity.

quite true.

> My take on this is that we should /document/ clearly what invariants any 
> given function satisfies, but I think the 'always view/always copy' view 
> excludes an important usage case.  There may be others beyond 
> contiguity, but that's the one that pops immediately to mind.

there's asarray() of course.

My feeling is that functions that may or may not return a copy should be 
functions, like asarray(), that ONLY exist to ensure a particular invariant.



I imagine there are others.

What concerns me is functions like reshape() and ravel() that you might 
have all sorts of other reasons to use, but then can't ever know for 
sure if your method is going to be working with a copy or not.


Christopher Barker, Ph.D.
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

Chris.Barker at noaa.gov

More information about the Numpy-discussion mailing list