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

STINNER Victor report at bugs.python.org
Tue Dec 16 15:53:57 CET 2008


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

Please don't promote this ugly code "len(bin(x).lstrip('-0b'))". It's 
not the best way to compute the number of bits... I prefer fredrikj's 
proposition (with // 2, few people understand >> 1).

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


More information about the Python-bugs-list mailing list