bob gailer wrote:
> On 2/28/2012 11:40 AM, Peter Otten wrote:
>
> def product(factors, product=1):
> for factor in factors:
> product *= factor
> return product
>
> can be "simplified"
>
> def product(factors):
>import operator
>return reduce(operator.mul, factors)
I
On 2/28/2012 11:40 AM, Peter Otten wrote:
def product(factors, product=1):
for factor in factors:
product *= factor
return product
can be "simplified"
def product(factors):
import operator
return reduce(operator.mul, factors)
--
Bob Gailer
919-636-4239
Chapel Hill NC
_
Sivaram Neelakantan wrote:
>
> I was wondering whether there is a faster/better/cleaner way of
> element wise operations of arbitrarily nested list. I wrote something
> like this for 1 level nested lists and am wondering whether there are
> any good idioms in python. I did this after a ridiculo
I was wondering whether there is a faster/better/cleaner way of
element wise operations of arbitrarily nested list. I wrote something
like this for 1 level nested lists and am wondering whether there are
any good idioms in python. I did this after a ridiculous amount of
bad thinking/missteps in