PP
ben.fisherownerJuly 2, 2010
In Python 2.7 and 3.1, numbers have
a .bit_length() method.

>>> n = 37
>>> bin(n)
'0b100101'
>>> n.bit_length()
6