From: Alan G I. <ai...@am...> - 2006-10-19 13:06:22
|
On Thu, 19 Oct 2006, Ivan Vilata i Balaguer apparently wrote:=20 >>>> numpy.prod(())=20 > 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 arguments cumulatively to the=20 items of sequence, from left to right, so as to reduce=20 the sequence to a single value. For example,=20 reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates=20 ((((1+2)+3)+4)+5). The left argument, x, is the=20 accumulated value and the right argument, y, is the=20 update value from the sequence. If the optional=20 initializer is present, it is placed before the items of=20 the sequence in the calculation, and serves as a default=20 when the sequence is empty. If initializer is not given=20 and sequence contains only one item, the first item is=20 returned. hth, Alan Isaac (just a user) |