[Numpy-discussion] zeros() default type in Numeric3

Colin J. Williams cjw at sympatico.ca
Sat Mar 26 17:57:59 CST 2005


Stephen Walton wrote:

> zeros() in Numeric3 defaults to typecode='d' while in numarray it 
> defaults to typecode=None, which in practice means 'i' by default.  Is 
> this deliberate? Is this desirable?  I'd vote for zeros(), ones() and 
> the like to default to 'i' or 'f' rather than 'd' in the interest of 
> space and speed.
>
The following seems to show that the default data type for the numarray 
elements is Int32:

    Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)]
    on win32
    Type "help", "copyright", "credits" or "license" for more information.
     >>> import numarray as _n
     >>> a= _n.zeros(shape=(3, 3))
     >>> a._type
    Int32
     >>>

I don't use the typecodes as the numerictypes are much more explicit.

Colin W.




More information about the Numpy-discussion mailing list