Message108322
| Author |
zooko |
| Recipients |
fredrikj, mark.dickinson, pitrou, rhettinger, terry.reedy, vstinner, zooko |
| Date |
2010年06月21日.22:04:02 |
| SpamBayes Score |
0.010819301 |
| Marked as misclassified |
No |
| Message-id |
<1277157845.73.0.885521494438.issue3439@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 |
|