Claudio Grondi <[EMAIL PROTECTED]> wrote: ... > What I am also looking for is a conversion to base 256 (i.e where the > full byte is used and the string and the integer have the same actual > content if on appropriate endian machine), which would make the bit
gmpy supplies that, too: gmpy.binary(x) or x.binary(): returns a portable binary representation (base-256 little endian) of an mpz object, suitable for saving into a file (or db, whatever) -- this string can later be passed as the first argument to function gmpy.mpz (with a second argument with value 256) to reconstruct a copy of the original mpz object. > extraction comparable easy and effective as the i.__hex__() based method. I suspect bit-extraction is still going to be faster with getbit and friends, but I'm sure you can measure that for yourself (I'm stuck with a loaner machine these days, and don't currently have gmpy at hand). Alex -- http://mail.python.org/mailman/listinfo/python-list