On Mon, 07 Jun 2010 05:27:43 +1000 Lie Ryan <lie.1...@gmail.com> wrote: > In the most naive uses, map appears to have no advantage over list > comprehension; but one thing that map can do that list comprehension > still can't do without a walk around the park: > > def foo(func, args): > g = lambda x: x+1 > return [func(g, x) for x in args] > > foo(map, [[4, 6, 3], [6, 3, 2], [1, 3, 5]])
foo = lambda x: [y + 1 for y in x] [foo(x) for x in [[4, 6, 3], [6, 3, 2], [1, 3, 5]]] Didn't seem like such a long walk. -- D'Arcy J.M. Cain <da...@druid.net> | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner. -- http://mail.python.org/mailman/listinfo/python-list