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

Travis Oliphant oliphant.travis at ieee.org
Fri Aug 18 14:38:17 EDT 2006


Sebastian Haase wrote:
> 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:
>   
>
> Furthermore there are *lot's*  of more attributes to a scalar dtype, e.g.
>   

The scalar types are actual Python types (classes) whereas the dtype 
objects are instances.

The attributes you are seeing of the typeobject are very useful when you 
have an instance of that type.

With numpy.int32.itemsize you are doing the equivalent of

numpy.dtype.itemsize


-Travis





More information about the NumPy-Discussion mailing list