iterating bit-by-bit across int?
Brian Kelley
bkelley at wi.mit.edu
Sat Oct 25 08:04:28 EDT 2003
Tim Roberts wrote:
> 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
>
try
i = -1L
while i:
i = i >> 1
and then repeat the statement :) My only point is that you have to be
careful with long ints.
More information about the Python-list
mailing list