[Tutor] List comprehensions & matrix multiplication

Sean 'Shaleh' Perry shalehperry@attbi.com
Fri, 24 May 2002 15:12:08 -0700 (PDT)


> 
> def MatrixMultiply(first, second):
>     def sum(list):
>          def add(x, y): return x + y
>          return reduce(add, list)

import operator
return reduce(operator.add, list)