[Numpy-discussion] numpy.filled, again

Daniele Nicolodi daniele at grinta.net
Wed Jun 12 08:47:56 EDT 2013

On 12/06/2013 14:29, Robert Kern wrote:
> On Wed, Jun 12, 2013 at 1:26 PM, Daniele Nicolodi <daniele at grinta.net> wrote:
>> There where the additional proposal (mostly neglected on the original
>> thread) to add the 'fill' optional parameter to the array constructor:
>> np.ndarray(shape, fill=value)
>> has an obvious meaning to me.
>> I also don't really see why an np.empty() constructor exists, it seems
>> to do the same thing that np.ndarray() does.
> It predates numpy and the numpy.ndarray type.

I see, but I'm surprised by the fact that np.empty() is not an alias for
np.ndarray() neither is implemented in term of np.ndarray().

Since the constructor exists and it would be the "most pythonic" way of
constructing an ndarray object I don't see why it's usage should not be

>> However, I don't know if
>> adding a np.ndarray_like() constructor would make much sense.
> Also that.

I don't understand if you are saying that adding the fill parameter to
np.ndarray() is a good or a bad idea.  If it is a bad idea, what are the
drawbacks compared to the other two proposed solutions?


More information about the NumPy-Discussion mailing list