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

Fredrik Johansson report at bugs.python.org
Wed Nov 12 01:02:51 CET 2008


Fredrik Johansson <fredrik.johansson at gmail.com> added the comment:

In stdtypes.rst, x.numbits should be listed in the table under
"Bit-string Operations on Integer Types" and not in the table of
operations supported by all numeric types.

> (1) the number of bits should be computed first directly using C 
> arithmetic, and only recomputed using PyLong arithmetic if the C 
> computations overflow.

+1

> (4) I quite like the idea of having numbits be a property rather than a 
> method---might still be worth considering?

I'm not against.

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


More information about the Python-bugs-list mailing list