[Numpy-discussion] New numpy functions: filled, filled_like

Robin robince at gmail.com
Mon Jan 14 10:21:57 EST 2013


On Mon, Jan 14, 2013 at 2:57 PM, Benjamin Root <ben.root at ou.edu> wrote:
> I am also +1 on the idea of having a filled() and filled_like() function (I
> learned a long time ago to just do a = np.empty() and a.fill() rather than
> the multiplication trick I learned from Matlab).  However, the collision
> with the masked array API is a non-starter for me.  np.const() and
> np.const_like() probably make the most sense, but I would prefer a verb over
> a noun.

To get an array of 1's, you call np.ones(shape), to get an array of
0's you call np.zeros(shape) so to get an array of val's why not call
np.vals(shape, val)?

Cheers

Robins



More information about the NumPy-Discussion mailing list