Bitwise OR?

Clemens Hepper ethrandil at
Fri Mar 24 12:27:26 CET 2006

To look at the bit-structure i've implemented a little function:

def bitstring(number, digits=32):
  result = ""
  for a in xrange(digits):
    if number & 1:
      result += '1'
      result += '0'
   number >>= 1
  return result

I wonder if there is something like sizeof() for int numbers.

- eth

More information about the Python-list mailing list