[Numpy-discussion] Proposed X.flat solution

Travis Oliphant oliphant at ee.byu.edu
Fri Feb 18 11:13:16 EST 2005

O.K.  here is my X.flat solution.

I've decided to make use of the fancy-new, numarray-inspired idea of the 
UPDATEIFCOPY flag for array creation.  Basically, X.flat will create a 
new array if X is discontiguous but with the UPDATEIFCOPY flag set so 
that upon destruction the contents will get copied back to X. 

So, it will seem like the X.flat array is updating the original array 
(provided it get's dereferenced someday (which it should because you 
rarely) keep references to X.flat unless you really meant ravel(X).

This is the simplest solution.  It's not quite as fancy as the indexable 
iterator (which could still be implemented at some point) but it lets me 
move forward.


More information about the NumPy-Discussion mailing list