From: alex at somewhere.round.here (Alex)
Date: 04 May 1999 19:50:41 -0400
Subject: [Question] Functional style with lists
References: <372F2B01.25E0ECDD@lirmm.fr>
Message-ID: <etd6768bdim.fsf@m2-225-11.mit.edu>
X-UID: 1786                                                

You might want to look into the operator module.  Instead of 

>>> map(lamda x,y:x+y,map(L.getitem,(1,)*len(L)))

the commands 

>>> L = [ ("John",40), ("Monthy",35)]
>>> import operator
>>> reduce (operator.add, \
            map (operator.getitem, L, len(L) * (1, )), \
            0)
75

perhaps does what you expected.  Gets messy very fast, though...

Alex.




