On Tue, Jun 4, 2024 at 3:12 PM Rakshit Singh <[email protected]>
wrote:

> I am unable to wrap my head around it.
>
> Why would we make a zero array which is empty. It can be done by a normal
> np.array
>

`shape=()` would not be empty, but a scalar. `np.zeros(())` is the same as
`np.array(0.0)`, so it is meaningful, at least. An empty array would be one
where one of the axis dimensions is 0, which would make the difference
between `zeros()`, `ones()`, and `empty()` meaningless if they all shared a
default like that.

Nonetheless, I don't think we want to make that a default. It's rarely
desired, so it can be rarely requested in an explicit manner.

For `np.heaviside()`, a default value was intentionally left unspecified
because of the multiple conventions that people want. In the face of
ambiguity, refuse the temptation to guess.

I think we're comfortable with these choices at this time.

-- 
Robert Kern
_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: [email protected]

Reply via email to