On Thursday, September 6, 2012 5:01:12 PM UTC-7, jimbo1qaz wrote:
> Is it faster to use bitshifts or floor division? And which is better, & or %?
> 
> All divisors and mods are power of 2, so are binary operations faster? And 
> are they considered bad style?

OK, I decided to change my code. Which raises a similar question: Which one is 
better for setting a bit of a byte: |= or +=, assuming each will only be run 
once? Intuitively, I think |=, but some timeits are inconclusive, mainly 
because I don't know how it works.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to