> def remapmysql(a): > return (a[0], (a[1:])) > > def test_map(): > count = 100000 # count of simulated records > l1 = range(0, count) > l2 = range(count , 2 * count ) > l3 = range(2 * count, 3 * count ) > z1 = zip(l1, l2, l3) # simulate a mysql resultset > > d1 = dict(map(remapmysql,z1)) > > return d1
I'm not sure the map() is needed, as it could just be >>> d1 = dict((row[0], row[1:]) for row in z1) which worked in my tests. However either seems to work fairly well. -tkc -- http://mail.python.org/mailman/listinfo/python-list