Steven D'Aprano wrote:

An example might help. Back in the old days, before Python had a sum() function, the easiest way to add up a list of numbers was to use reduce and a small function to add two numbers:

def add(x, y):
    return x+y

total = filter(add, [2, 4, 5, 9, 1])

Arggggh! Of course, I meant *reduce* in that example, not filter. Sorry for any confusion!



--
Steven

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to