[issue3439] create a numbits() method for int and long types

STINNER Victor report at bugs.python.org
Tue Oct 14 18:20:36 CEST 2008


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

> Unless I missed something, numbits() is O(1).

Ooops, you're right. I looked quickly at the patch and I 
read "while(n)" but n is a digit, not the number of digits! So it's 
very quick to compute number of bits.

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


More information about the Python-bugs-list mailing list