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

konrad.hinsen at laposte.net konrad.hinsen at laposte.net
Mon Mar 28 02:30:07 EST 2005


On 26.03.2005, at 21:24, 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.

My main argument is a different one: consistency.

I see zeros() as an array constructor, a shorthand for calling array()  
with an explicit list argument. From that point of view,

	zeros((n,))

should return the same value as

	array(n*[0])

i.e. an integer array.

If people feel a need for a compact float-array generator, I'd rather  
have an additional function "fzeros()" than a modification of zeros(),  
whose behaviour in current Numeric and numarray is both consistent and  
well established.

Konrad.
--
------------------------------------------------------------------------ 
-------
Konrad Hinsen
Laboratoire Leon Brillouin, CEA Saclay,
91191 Gif-sur-Yvette Cedex, France
Tel.: +33-1 69 08 79 25
Fax: +33-1 69 08 82 61
E-Mail: khinsen at cea.fr
------------------------------------------------------------------------ 
-------






More information about the NumPy-Discussion mailing list