Fernando Perez wrote:
> Sweet! We now finally have mutable strings for Python:
>
> In [2]: astr =
> '\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00'
>
> In [4]: a = N.ndarray(shape=(2,2), dtype=N.int32, buffer=astr, order='F')
>
> In [5]: astr
> Out[5]: '\x00\x00\x00\x00\x01\x00\
On 8/14/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:
> 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
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, y
Matthew Brett wrote:
> Hi,
>
> I am sorry if this is obvious, but:
>
It's O.K. I don't think many people are used to the fortran-order
stuff. So, I doubt it's obvious.
> For example, here is 0,1,2,3 as int32
>
> str = '\x00\x00\x00\x00\x01\x00\x00\x00\x02\x00\x00\x00\x03\x00\x00\x00'
>
> What