mirror of https://github.com/python/cpython.git
Merged revisions 67857 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r67857 | mark.dickinson | 2008-12-19 17:46:51 +0000 (Fri, 19 Dec 2008) | 2 lines Fix typo in Python equivalent for bit_length. ........
This commit is contained in:
parent
d3e18b7113
commit
a9da6d1a7b
|
@ -442,7 +442,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