Hi list,
maybe this is a really stupid idea, and I don't want to advertise this, but
what actually happens when I reassign the dtype of an object?
Does it return the same as array.view?
say I have the following code
In [64]: b
Out[64]:
array([[ 0, 1, 2],
[ 3, 4, 5],
[ 6, 7, 8],
[ 9, 10, 11],
[12, 13, 14]])
<snip />
In [69]: t = N.dtype(zip(('a', 'b', 'c'), (N.int32, N.int32, N.int32)))
In [70]: b.view(t)
Out[70]:
array([[(0, 1, 2)],
[(3, 4, 5)],
[(6, 7, 8)],
[(9, 10, 11)],
[(12, 13, 14)]],
dtype=[('a', '<i4'), ('b', '<i4'), ('c', '<i4')])
<snip />
In [75]: b.dtype=t
In [76]: b
Out[76]:
array([[(0, 1, 2)],
[(3, 4, 5)],
[(6, 7, 8)],
[(9, 10, 11)],
[(12, 13, 14)]],
dtype=[('a', '<i4'), ('b', '<i4'), ('c', '<i4')])
So in this case is b.dtype = t the same as b = b.view(t)?
Or is this paradigm deprecated for some reason?
Just curious.
Thanks,
Jan