Fix typo in Python equivalent for bit_length.
This commit is contained in:
parent
ba666a59db
commit
4b3ed5d8ba
|
@ -471,7 +471,7 @@ Additional Methods on Integer Types
|
|||
Equivalent to::
|
||||
|
||||
def bit_length(self):
|
||||
s = bin(x) # binary representation: bin(-37) --> '-0b100101'
|
||||
s = bin(self) # binary representation: bin(-37) --> '-0b100101'
|
||||
s = s.lstrip('-0b') # remove leading zeros and minus sign
|
||||
return len(s) # len('100101') --> 6
|
||||
|
||||
|
|
Loading…
Reference in New Issue