[Numpy-discussion] Pleasantly surprised by recarray

Neal Becker ndbecker2@gmail....
Fri Jun 24 06:46:10 CDT 2011

I was pleasantly surprised to find that recarrays can have a recursive 
structure, and can be defined using a nice syntax:

dtype=[('deltaf', float),('eq', bool),('filt', 
[('pulse', 'a10'), ('alpha', float)])]

However, this I discovered just by guessing.  It would be good to mention this 
in the reference doc.

BTW, one unfortunate side effect of using recarrays with elements that are not 
simple types is that identity comparison seems to fail.  That is, when 
addressing my previous problem

for e in arr:

That would apparantly need to be:

for e in array:
  experiments[e['deltaf'], tuple(e['filt'])].append(e)

Unless e['filt'] is converted to tuple, it's type is:
Out[55]: <type 'numpy.void'>

which does not seem to identity compare as I would want.

More information about the NumPy-Discussion mailing list