[Numpy-discussion] zeros() default type in Numeric3
Robert Kern
rkern at ucsd.edu
Mon Mar 28 07:44:18 EST 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.
For zeros() and ones(), I don't think space and speed are going to be
affected by the default typecode. In my use of these functions, I almost
always need a specific typecode. If I use the default, it's because I
actually need the default typecode. Unfortunately, I almost always want
Float and not Int, so all of my code is littered with
zeros(shape, Float)
I'll bet Travis's code looks the same.
I would *love* to be able to spell these things like
Float.zeros(shape)
UInt8.ones(shape)
Complex32.array(other)
...
Then we could leave zeros() and ones() defaults as they are for
backwards compatibility, and deprecate the functions.
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the NumPy-Discussion
mailing list