On Mon, Feb 07, 2005 at 07:07:10PM +0100, Francis Girard wrote: > Zut ! > > I'm very sorry that there is no good use case for the "reduce" function in > Python, like Peter Otten pretends. That's an otherwise very useful tool for > many use cases. At least on paper. > > Python documentation should say "There is no good use case for the reduce > function in Python and we don't know why we bother you offering it."
I am guessing you are joking, right? I think Peter exaggerates when he says that "there will be no good use cases for reduce"; it is very useful, in writing very compact code when it does exactly what you want (and you have to go through hoops to do it otherwise). It also can be the fastest way to do something. For example, the fastest way to get the factorial of a (small enough) number in pure python is factorial = lambda n: reduce(operator.mul, range(1, n+1)) -- John Lenton ([EMAIL PROTECTED]) -- Random fortune: Laugh and the world thinks you're an idiot.
signature.asc
Description: Digital signature
-- http://mail.python.org/mailman/listinfo/python-list