[issue31079] mathematically wrong results from int and long bit_length methods

vinsci report at bugs.python.org
Sun Jul 30 13:53:26 EDT 2017


vinsci added the comment:

>>> (0).bit_length.__doc__
"int.bit_length() -> int\n\nNumber of bits necessary to represent self in binary.\n>>> bin(37)\n'0b100101'\n>>> (37).bit_length()\n6"

The library documentation has clearly been written in disregard of the advertised functionality in the docstrings of the methods.

The documentation is just echoing the flaws of the unit tests.

For the Python 3 variant of this issue, it can be added that the library documentation wrongly states that the method is "New in version 3.1.".

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue31079>
_______________________________________


More information about the Python-bugs-list mailing list