mirror of
https://github.com/python/cpython.git
synced 2025-09-24 01:13:22 +00:00
Minor docs issue.
This commit is contained in:
parent
b00697e67c
commit
c5b81eebd8
1 changed files with 1 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue