Minor docs issue.
This commit is contained in:
parent
b00697e67c
commit
c5b81eebd8
|
@ -452,7 +452,7 @@ Additional Methods on Integer Types
|
||||||
Equivalent to::
|
Equivalent to::
|
||||||
|
|
||||||
def bit_length(self):
|
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
|
s = s.lstrip('-0b') # remove leading zeros and minus sign
|
||||||
return len(s) # len('100101') --> 6
|
return len(s) # len('100101') --> 6
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue