On Sat, 02 Jul 2005 20:26:31 -0700, Devan L wrote: > Claiming that sum etc. do the same job is the whimper of > someone who doesn't want to openly disagree with Guido. > > Could you give an example where sum cannot do the job(besides the > previously mentioned product situation?
There is an infinite number of potential lambdas, and therefore an infinite number of uses for reduce. sum only handles a single case, lambda x,y: x+y product adds a second case: lambda x,y: x*y So sum and product together cover precisely 2/infinity, or zero percent, of all possible uses of reduce. > Also, map is easily replaced. > map(f1, sequence) == [f1(element) for element in sequence] Three mental tokens ( map, f1, sequence ) versus seven ( [], f1, element, for, element, in, sequence ). Also, map can take any number of sequences: map(f1, seq1, seq2, seq3, seq4, ...) -- Steven. -- http://mail.python.org/mailman/listinfo/python-list