Re: [Numpy-discussion] Product of an empty sequence

2006-10-19 Thread Ivan Vilata i Balaguer
En/na Travis Oliphant ha escrit:: > Ivan Vilata i Balaguer wrote: >> 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. OK, I guess that means it'

Re: [Numpy-discussion] Product of an empty sequence

2006-10-19 Thread Travis Oliphant
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

Re: [Numpy-discussion] Product of an empty sequence

2006-10-19 Thread Alan G Isaac
On Thu, 19 Oct 2006, Ivan Vilata i Balaguer apparently wrote: numpy.prod(()) > 1.0 > Wouldn't be 0.0 a more natural answer? I think it must be 1 or a TypeError. E.g., http://docs.python.org/lib/built-in-funcs.html#reduce reduce(function, sequence[, initializer]) Apply function of two a