Long Shifty Bits

Michael Hudson mwh21 at cam.ac.uk
Tue Mar 6 14:00:51 EST 2001


Phlip <phlip_cpp at my-deja.com> writes:

> Not hyp:
> 
> I want this expression to make sense:
> 
>         x = 1L << 200
> 
> If someone tells me "it will roll over at the 32nd bit", or mayby
> even "it will roll over when the CPU damn well feels like it",
> that's okay. I'l just construct a Bit Vector of some ilk and drop my
> bits into it. But the above notation is closest to our problem
> space, so it would be nice if it worked as expected.

Works for me.  Have you tried it?

It's not the solution to use if your bit vectors are sparse.  Also if
you mutate your bitvectors a lot, you might want to use an array or
list instead.

Cheers,
M.

-- 
  It's a measure of how much I love Python that I moved to VA, where
  if things don't work out Guido will buy a plantation and put us to
  work harvesting peanuts instead.     -- Tim Peters, comp.lang.python



More information about the Python-list mailing list