Fri, 23 Jul 2010 10:29:47 -0400, Alan G Isaac wrote:
[clip]
>          >>> np.subtract.reduce([])
>          0.0
> 
> Getting a right identity for an empty array is surprising. Matching
> Python's behavior (raising a TypeError) seems desirable. (?)

I don't think matching Python's behavior is a sufficient argument for a 
change. As far as I see, it'd mostly cause unnecessary breakage, with no 
significant gain.

Besides, it's rather common to define

        sum_{z in Z} z = 0
        prod_{z in Z} z = 1

if Z is an empty set -- this can then be extended to other reduction 
operations. Note that changing reduce behavior would require us to 
special-case the above two operations.

-- 
Pauli Virtanen

_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to