about lambda

bonono at gmail.com bonono at gmail.com
Sun Nov 20 14:41:39 CET 2005


Shi Mu wrote:
> what does the following code mean? It is said to be used in the
> calculation of the overlaid area size between two polygons.
> map(lambda x:b.setdefault(x,[]),a)

The equivalent of :

def oh_my_yet_another_function_name_why_not_use_lambda(x):
  b.setdefault(x,[])

map(oh_my_yet_another_function_name_why_not_use_lambda, a)

Or

for x in a:
  b.setdefault(x,[])




More information about the Python-list mailing list