Travis Oliphant wrote:
> However, you can use the ndarray creation function itself to do what you 
> want:
>
> a = ndarray(shape=(2,2), dtype=int32, buffer=str, order='F')
>
> This will use the memory of the string as the new array memory.
>   
Incidentally, the new array will be read-only.  But, you can fix this in 
two ways:

1) a.flags.writeable = True

   --- This is a cheat that avoids the extra copy on pickle-load and 
let's you use strings as writeable buffers.  Don't abuse it.  It will 
disappear once Python 3k has a proper bytes type.

2) a = a.copy()


-Travis




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to