[Numpy-discussion] Re: Multiarray PEP
Colin J. Williams
cjw at sympatico.ca
Thu Feb 17 17:14:40 CST 2005
Russell E. Owen wrote:
>In article <421446E3.7080202 at ee.byu.edu>,
> Travis Oliphant <oliphant at ee.byu.edu> wrote:
>
>
>
>>I've never had a problem with just the typecode characters although
>>aliases (like Int16 or Short) which might be more meaningful are nice.
>>Are shadow-classes important in this case? To me they look a little
>>like extra bulk with no gain. I'd love to be educated as to why it is
>>worth the extra effort to have a bunch of instances lying around.
>>
>>
>
>Instances can give you useful information. For example:
>- the number of bytes needed to represent a value
>
>
>>> import numarray.numarraycore as _n
>>> a= _n.arange(9, shape= (3, 3))
>>> print 'bytes per element:', a.itemsize()
bytes per element: 4
Alternatively:
>>> a._type.bytes
4
>- the min and max values for that type (numarray doesn't do this yet,
>but I really hope it'll be added someday).
>
>
This could come from the type instance but it's not too difficult to
determine for a given type.
>I personally dislike character codes because they are uninformative and
>because they meaningless without the documentation.
>
>
>
(+1)
Colin W.
More information about the Numpy-discussion
mailing list