On 07/31/2010 12:15 PM, Lawrence D'Oliveiro wrote: >reduce(lambda a, b : a + b, (y * y for y in V), 0)) >
This is a lot more verbose than it has to be, and probably slower too. firstly: (lambda a,b: a+b) is equivalent to operator.add. ==> reduce(operator.add, (y*y for y in V), 0) However - reduce with operator.add ? we have a special name for this: ==> sum(y*y for y in V) -- http://mail.python.org/mailman/listinfo/python-list