Message108322
There is a small mistake in the docs:
def bit_length(x):
'Number of bits necessary to represent self in binary.'
s = bin(x) # binary representation: bin(-37) --> '-0b100101'
s = s.lstrip('-0b') # remove leading zeros and minus sign
return len(s) # len('100101') --> 6
is probably supposed to be:
def bit_length(x):
'Number of bits necessary to represent x in binary.'
s = bin(x) # binary representation: bin(-37) --> '-0b100101'
s = s.lstrip('-0b') # remove leading zeros and minus sign
return len(s) # len('100101') --> 6 |
|
| Date |
User |
Action |
Args |
| 2010-06-21 22:04:06 | zooko | set | recipients:
+ zooko, rhettinger, terry.reedy, mark.dickinson, pitrou, vstinner, fredrikj |
| 2010-06-21 22:04:05 | zooko | set | messageid: <[email protected]> |
| 2010-06-21 22:04:03 | zooko | link | issue3439 messages |
| 2010-06-21 22:04:02 | zooko | create | |
|