newbie: working iwth list of tuples

falcon shahbazc at gmail.com
Sun Jan 29 07:35:22 CET 2006


I forgot to add that I passing a tuple of functions to the reduce
function but apparently that is not allowed.  My guess was that a tuple
made up of individual (simple) functions might be easier to manipulate
programatically than a function which has to know the structure of a
list.

(My test code)
x=[('a',1),('a',1),('a',3),('b',1),('b',2),('c',2),('c',3),('c',4)]
reduce((lambda x,y: x+y,lambda x,y: x+y),x)




More information about the Python-list mailing list