Bitshifts and "And" vs Floor-division and Modular

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Sep 6 20:30:41 EDT 2012


On 07/09/2012 01:01, 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?
>

Why don't you use the timeit module and find out for yourself?

-- 
Cheers.

Mark Lawrence.




More information about the Python-list mailing list