Fredrik Johansson <fredrik.johans...@gmail.com> added the comment:

When did the name change back to numbits? Anyway, I think this reference
implementation is better:

def numbits(x):
    x = abs(x)
    n = 0
    while x:
        n += 1
        x //= 2
    return n

(//= 2 could be changed to >>= 1)

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue3439>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to