[SciPy-Dev] why this not report an error for a.dtype=float when a is mixed struc array
Skipper Seabold
jsseabold@gmail....
Sat Jun 5 10:20:05 CDT 2010
On Sat, Jun 5, 2010 at 11:09 AM, Vincent Davis <vincent@vincentdavis.net> wrote:
> 2010/6/5 Stéfan van der Walt <stefan@sun.ac.za>:
>> On 4 June 2010 17:49, Vincent Davis <vincent@vincentdavis.net> wrote:
>>> Is there a reason not to have this return an error.
>>>>>> a1 = np.array([(1,3.3),(2,4.4)], dtype=[('a', int),('b', float)])
>>>>>> a1
>>> array([(1, 3.2999999999999998), (2, 4.4000000000000004)],
>>> dtype=[('a', '<i8'), ('b', '<f8')])
>>>>>> a1.dtype=float
>>>>>> a1
>>> array([ 4.94065646e-324, 3.30000000e+000, 9.88131292e-324,
>>> 4.40000000e+000])
>>
>> This is a feature! Sometimes, it is handy to view the raw memory in
>> different ways.
>
You might find this thread helpful. Especially, Chris's reply.
http://thread.gmane.org/gmane.comp.python.numeric.general/32664/
Skipper
More information about the SciPy-Dev
mailing list