Multiplying all the values in a dictionary

Adam DePrince adam.deprince at gmail.com
Fri Mar 24 06:26:12 CET 2006


Excuse me, I mean

 python2.4 -mtimeit -s 'from numarray import array; d =
{(100,500):[5,5], (100,501):[6,6],
(100,502):[7,7]}; x = dict(d);' 'for i in x.values():
 i[0]*=1;i[1]*=1'
1000000 loops, best of 3: 1.72 usec per loop

i[0]*=1, not j[0]*=1 ...




More information about the Python-list mailing list