Bitshifts and "And" vs Floor-division and Modular

Terry Reedy tjreedy at udel.edu
Thu Sep 6 21:53:56 EDT 2012


On 9/6/2012 8:01 PM, 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?

Yes, meaningless, yes, and no.
I would do what seems sensible to you in the context.

-- 
Terry Jan Reedy




More information about the Python-list mailing list