[Numpy-discussion] attributes of scalar types - e.g. numpy.int32.itemsize

Sebastian Haase haase at msg.ucsf.edu
Fri Aug 18 13:26:12 CDT 2006


Hi,
array dtype descriptors have an attribute itemsize  that gives the total 
number of bytes required for an item of that dtype.

Scalar types, like  numy.int32, also have that attribute,
but it returns "something else" - don't know what:
>>> a.dtype.itemsize
4
>>> a.dtype.name
'float32'
>>> N.int32.itemsize
<attribute 'itemsize' of 'genericscalar' objects>

Furthermore there are *lot's*  of more attributes to a scalar dtype, e.g.

>>> N.int32.data
<attribute 'data' of 'genericscalar' objects>
>>> N.int32.argmax()
Traceback (most recent call last):
  File "<input>", line 1, in ?
TypeError: descriptor 'argmax' of 'genericscalar' object needs an argument

Are those useful ? 

Thanks,
Sebastian Haase




More information about the Numpy-discussion mailing list