[SciPy-Dev] why this not report an error for a.dtype=float when a is mixed struc array
Sat Jun 5 10:49:09 CDT 2010
On Sat, Jun 5, 2010 at 9:20 AM, Skipper Seabold <email@example.com> wrote:
> On Sat, Jun 5, 2010 at 11:09 AM, Vincent Davis <firstname.lastname@example.org> wrote:
>> 2010/6/5 Stéfan van der Walt <email@example.com>:
>>> On 4 June 2010 17:49, Vincent Davis <firstname.lastname@example.org> 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)])
>>>> array([(1, 3.2999999999999998), (2, 4.4000000000000004)],
>>>> dtype=[('a', '<i8'), ('b', '<f8')])
>>>> array([ 4.94065646e-324, 3.30000000e+000, 9.88131292e-324,
>>> 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.
Ok now I understand why, that is why the numbers are a mess but not
why it is a feature :) I guess I am try to think of why I would use
this. I might be completely wrong but if most users would expect a
different behavior and don't notice what is actually happening then
maybe there should be a warning and a different way to get the current
> SciPy-Dev mailing list
More information about the SciPy-Dev