On Thu, Nov 11, 2010 at 11:51:33AM +0200, Alexander Gattin wrote: > functional-style code emerges: > > > >>> dict(filter(lambda t: t[1], > > ... map(lambda k: (k, filter(lambda v: v in dict2[k][0], dict1[k][0])), > > ... filter(dict2.has_key, dict1.iterkeys())) > > ... ) > > ... )
Sorry, the indentation for the above code is plain wrong. I'm not accustomed to lisp-indenting, and only have managed to produce the next version below: > >>> dict(filter(lambda t: t[1], > ... map(lambda k: (k, filter(lambda v: v in dict2[k][0], > ... dict1[k][0] > ... ) > ... ), > ... filter(dict2.has_key, dict1.iterkeys()) > ... ) > ... ) > ... ) > {'ac': [1, 3, '79b'], 'ab': [2, 'd3']} > >>> -- With best regards, xrgtn -- http://mail.python.org/mailman/listinfo/python-list