Product of an empty sequence

Travis Oliphant oliphant.travis at ieee.org
Thu Oct 19 09:27:20 CDT 2006


Ivan Vilata i Balaguer wrote:
> Today I was surprised by this::
>
>   
>>>> import numpy
>>>> numpy.__version__
>>>>         
> '1.0.dev3341'
>   
>>>> numpy.prod(())
>>>>         
> 1.0
>
> Wouldn't be 0.0 a more natural answer?  I understand that 1 is neutral
> on product operations, but I still can't see why 1.0 is a better answer.
>   

It's the identity for the multiplication ufunc.  

>  Sorry for the clueless question, but I have searched lists, docstrings
> and web and found nothing about this.
>
> (BTW, the definitions of ``prod()`` and ``product()`` are still
> identical as noted by Sebastian Haase some time ago.)
>   
Is this a problem?

-Travis


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642




More information about the Numpy-discussion mailing list