As long as you are optimizing, addition is slightly faster than
multiplication:

$ python2.4 -mtimeit 'h=1;h*=2'
1000000 loops, best of 3: 0.286 usec per loop

$ python2.4 -mtimeit 'h=1;h=h+h'
1000000 loops, best of 3: 0.23 usec per loop

Of course, that's only a 20% decrease, so it might not be worth the
trouble.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to