why the inconsistency?

Alex Martelli aleax at aleax.it
Sun Sep 28 00:49:33 CEST 2003


Anton Vredegoor wrote:
   ...
> Some fast way of computing a tuple (bitmask,nbits) from a long integer
> in Python can be interesting anyway, if only to facilitate bit
> twiddling experiments. Below's a -probably buggy- part of a

Sure, but I think gmpy already offers good and fast functions for all of 
these needs.  E.g., gmpy.numdigits(x, 2) for the number of bits, and
also getbit, setbit, lowbits, ...


Alex





More information about the Python-list mailing list