Converting a hex string to a number
spam-here
spam at your-site.com
Tue Jul 9 11:55:17 EDT 2002
Alex Martelli <aleax at aleax.it> wrote:
AM# me wrote:
AM# ...
>> Like this solution. Is there a way to use that long as hex, so bit
>> operations can be done on it piecewise? Slice a byte, then xor it or
>> and it, and put it back?
AM# Longs, like ints and other kinds of numbers, are immutable -- so each
AM# time you change even one bit you're allocating a new one and copying
AM# all the rest. Use an array.array with a typecode of 'B' (unsigned bytes),
AM# it may prove substantially better-performing as it's mutable.
AM# Alex
thanks,
stan
More information about the Python-list
mailing list