Return a recarray from the (parsed) string.

def recarray(self):
        """Return a recarray from the (parsed) string."""

        if self.records is None:
            self.parse()
        try:
            # simple (should this also be subjected to convert.to_int64() ?)
            return numpy.rec.fromrecords(self.records, names=self.names)
        except ValueError:
            # complicated because fromrecords cannot deal with records of lists
            # Quick hack: use objects for lists etc (instead of building the proper
            # data types (see docs for numpy.dtype , eg dtype('coord', (float, 3)) )

            D = numpy.empty(len(self.records[0]), dtype=object)    # number of fields from first record
            types = numpy.array([map(type, r) for r in self.records])  # types of all fields
            for icol, isSame in enumerate([numpy.all(col) for col in types.T]):
                if isSame:
                    D[icol] = types[0][icol]
                else:
                    D[icol] = object
            dtype = numpy.dtype(zip(self.names, D))
            # from numpy.rec.records
            # TODO: this is not working properly yet; for instance, text fields
            # are reduced to length 0 (<U0) and the final convert.to_int64 dies
            # with '<U0'*** TypeError: TypeError('data type not understood',)
            retval = numpy.array(self.records, dtype=dtype)
            res = retval.view(numpy.recarray)
            ## res.dtype = numpy.dtype((numpy.rec.record, res.dtype))  # fails -- ARGH, this makes it a recarray
            return convert.to_int64(res)