iterating bit-by-bit across int?

Tim Roberts timr at probo.com
Sat Oct 25 02:10:38 EDT 2003


Brian Kelley <bkelley at wi.mit.edu> wrote:

>Paul Rubin wrote:
>> 
>> Long ints can have as many bits as you want.
>
>Such as -1L which has an infinite number of bits.

Oh come on, that's just silly.  If that were true, I could not type this at
a Python prompt because it would cause an overflow:

   i = -1L

-1L, in fact, has exactly the same number of bits as 1L and, probably,
1048576L.
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.




More information about the Python-list mailing list