![]() |
|
|
+ Search |
![]()
|
Nov 6th, 2002 08:41
Allan Caetano, unknown unknown, Alex, Nathan Froyd
Yeah, use the operator module >>> import operator >>> operator.add (5, 2) 7 >>> operator.mul (5, 2) 10 >>> example:: If I want to have the length of a vector v writing reduce(lambda x,y:x+y,map(lambda x:x*x,v)) is not really nice. Instead I can write something like: reduce(operator.add, map(operator.mul, v, v))