[SciPy-dev] Some suggestions for scipy_core

Francesc Altet faltet at carabos.com
Tue Jan 3 13:07:36 EST 2006


Hi,

Attached is a patch (against SVN 1764) that implements a new typeNA
dictionary that provides mappings between numarray<-->scipy_core
datatypes. This solves a couple of issues:

- Logically separates the datatypes in typeDict (where it remains just
the scipy_core types) from the datatypes present in numarray, that are
in the new typeNA. This also relieves doing ugly mappings in current
typeDict, like 'Complex32'-->complex64_arrtype and
'Complex64'-->complex128_arrtype.

- Now, there is a direct way to get the numarray type coming from a
scipy_core type. For example:

In [27]: q=scicore.array([1],dtype='Q')

In [28]: scicore.typeNA[q.dtypechar]
Out[28]: 'UInt64'

In [29]: scicore.typeNA[q.dtype]
Out[29]: 'UInt64'

that was not possible before.

OTOH, I'd have preferred to follow the numarray convention (except
perhaps for complex types were the full bit-wide would have been more
consistent) for the long string representation of scipy_core types.
For example, we could have:

In [30]: q.dtypedescr.dtypestr
Out[30]: 'UInt64'

which I find clearer than the current:

In [30]: q.dtypedescr.dtypestr
Out[30]: '<u8'

of course, we would have lost the information of the byteorder, but
this is always accessible in:

In [31]: q.dtypedescr.byteorder
Out[31]: '='

Anyway, I guess that Travis has announced the new type naming schema
long time ago and I lost the opportunity to chime in by then, so never
mind.

Cheers,

-- 
>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"

-------------- next part --------------
A non-text attachment was scrubbed...
Name: numerictypes.patch
Type: text/x-diff
Size: 2286 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20060103/cc28d24a/attachment.patch>


More information about the SciPy-Dev mailing list