[Numpy-discussion] numpy scalar types

Sebastian Haase haase at msg.ucsf.edu
Tue Jul 25 01:09:37 EDT 2006


Hi,
I just ran a simple test which I think would be of general interest.
It's about types and what there names are in the numpy module
(and how many different names there are for a given type !!)
Cheers, Sebastian Haase
       (maybe there is a good place in the wiki for this !?)
 >>> N.csingle
<type 'complex64scalar'>
 >>> N.cdouble
<type 'complex128scalar'>
 >>> N.cfloat
<type 'complex128scalar'>

and all together !!
 >>> for tt in N.ScalarType:
...     l=[k for k,v in N.__dict__.iteritems() if v == tt]
...     print len(l), tt, l
...
0 <type 'int'> []
0 <type 'float'> []
0 <type 'complex'> []
0 <type 'long'> []
0 <type 'bool'> []
0 <type 'str'> []
0 <type 'unicode'> []
0 <type 'buffer'> []
2 <type 'int64scalar'> ['longlong', 'int64']
2 <type 'int16scalar'> ['int16', 'short']
2 <type 'int32scalar'> ['int32', 'int_']
2 <type 'uint32scalar'> ['uint', 'uint32']
2 <type 'unicodescalar'> ['unicode_', 'unicode0']
2 <type 'complex64scalar'> ['complex64', 'csingle']
3 <type 'int32scalar'> ['intp', 'intc', 'int0']
4 <type 'complex128scalar'> ['cfloat', 'complex_', 'cdouble', 'complex128']
3 <type 'stringscalar'> ['string', 'str_', 'string0']
3 <type 'float96scalar'> ['float96', 'longfloat', 'longdouble']
2 <type 'uint16scalar'> ['ushort', 'uint16']
2 <type 'objectscalar'> ['object0', 'object_']
3 <type 'float64scalar'> ['double', 'float64', 'float_']
2 <type 'int8scalar'> ['byte', 'int8']
2 <type 'uint8scalar'> ['uint8', 'ubyte']
2 <type 'boolscalar'> ['bool8', 'bool_']
2 <type 'float32scalar'> ['float32', 'single']
3 <type 'complex192scalar'> ['complex192', 'clongdouble', 'clongfloat']
3 <type 'uint32scalar'> ['uintc', 'uint0', 'uintp']
2 <type 'uint64scalar'> ['uint64', 'ulonglong']
2 <type 'voidscalar'> ['void', 'void0']





More information about the NumPy-Discussion mailing list