El ds 13 de 01 del 2007 a les 14:42 +0900, en/na David Cournapeau va escriure: > > No, only if it's contiguous (I'm not sure about alignment) > According to numpy ebook, you need alignement for deferencing > pointers. But I guess non aligned arrays are not really common.
Unaligned arrays can be quite common if you use recarrays often: In [18]:a=numpy.empty(3, dtype="S1,i4,f8") In [19]:a.dtype.fields.items() Out[19]: [('f0', (dtype('|S1'), 0)), ('f1', (dtype('int32'), 1)), ('f2', (dtype('float64'), 5))] In [20]:f1=a['f1'] In [21]:f1.flags Out[21]: C_CONTIGUOUS : False F_CONTIGUOUS : False OWNDATA : False WRITEABLE : True ALIGNED : False UPDATEIFCOPY : False And dereferencing unaligned pointers do cause a crash in general, but not in all architectures (i386 being one of them). Cheers, -- Francesc Altet | Be careful about using the following code -- Carabos Coop. V. | I've only proven that it works, www.carabos.com | I haven't tested it. -- Donald Knuth _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion