[Numpy-discussion] View on same data with different type

Florian Schulze florian.proff.schulze at gmx.net
Thu Dec 2 12:51:05 EST 2004


I would like to be able to access the same array (memory location) with 
arrays of different size and with different typecodes. Let's say I have an 
array of 8 UInt8 and I want to view it as 2 UInt32. I want to be able to 
change the content of either array and the change should be visible in 
both arrays. To speak in C notation, I want an *UInt8 and a *Uint32 to the 
same memory location.
Is that possible with Numeric or numarray, maybe even with slices of the 
same data?
The reason I want this is that I want to prevent copying memory around. It 
would be even cooler if this would work with mmaped arrays, though then 
it's enough when it would work with read only mmaps. BTW, why isn't it 
allowed to create overlapping mmap slices?

Florian Schulze

More information about the NumPy-Discussion mailing list