why the inconsistency?

Alex Martelli aleax at aleax.it
Sat Sep 27 18:49:33 EDT 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