tag:blogger.com,1999:blog-7451330209409602076.post7140275302631401939..comments2023-10-20T07:07:10.186-07:00Comments on Half Hour Hacks: Bit packing preprocessorben.fisherhttp://www.blogger.com/profile/07306557553230548957noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-7451330209409602076.post-21009096752013634002010-07-02T10:47:22.058-07:002010-07-02T10:47:22.058-07:00In Python 2.7 and 3.1, numbers have
a .bit_length...In Python 2.7 and 3.1, numbers have <br />a .bit_length() method.<br /><br />>>> n = 37<br />>>> bin(n)<br />'0b100101'<br />>>> n.bit_length()<br />6ben.fisherhttps://www.blogger.com/profile/07306557553230548957noreply@blogger.com