On Thu, 20 Aug 2009 08:10:28 +0200, Peter Otten wrote:
> I just can't stop posting this one: > >>>> from itertools import izip >>>> it = iter([1,2,3,4,5,6]) >>>> dict(izip(it, it)) > {1: 2, 3: 4, 5: 6} > > I really tried, but yours drove me over the edge. If you want something to drive you over the edge: >>> alist = [1, 2, 3, 4, 5, 6] >>> dict(apply(zip, map(lambda n: map(lambda t: t[1], filter(lambda t: ((not (t[0]%2)) == 1) == n, enumerate(alist))), range(1, -1, -1)))) {1: 2, 3: 4, 5: 6} Enjoy :) -- Steven -- http://mail.python.org/mailman/listinfo/python-list