|
From: Francesc A. <fa...@ca...> - 2006-01-31 17:16:36
|
Hi,
I've detected a couple of issues in records.py. For the first one, the
next should fix it:
Index: numpy/core/records.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=2D-- numpy/core/records.py (revision 2033)
+++ numpy/core/records.py (working copy)
@@ -410,7 +410,8 @@
offset=3Doffset)
elif isinstance(obj, sb.ndarray):
res =3D obj.view(recarray)
=2D if issubclass(res.dtype, nt.void):
+ if issubclass(res.dtype.type, nt.void):
res.dtype =3D sb.dtype((record, res.dtype))
+ return res
else:
raise ValueError("Unknown input type")
Now, another curious thing (sorry, no patch this time):
In [6]: for i in numpy.rec.array([(1,2)], formats=3D'u4,u4'): print i
...:
(1L, 2L)
[No problem with this]
In [7]: for i in numpy.rec.array([(1,2)], formats=3D'u4,u4')[0]: print i
...:
=2D------------------------------------------------------------------------=
=2D-
exceptions.KeyError Traceback (most recent=
=20
call last)
/home/faltet/computacio.nobackup/hdf5-1.7.51/test/<console>
/usr/lib/python2.3/site-packages/numpy/core/records.py in __getitem__(self,=
=20
obj)
126
127 def __getitem__(self, obj):
=2D-> 128 return self.getfield(*(self.dtype.fields[obj][:2]))
129
130 def __setitem__(self, obj, val):
KeyError: 0
I'd expect something like
1L
2L
Cheers,
=2D-=20
>0,0< Francesc Altet =A0 =A0 http://www.carabos.com/
V V C=E1rabos Coop. V. =A0=A0Enjoy Data
"-"
|