int/long unification hides bugs

Steve Holden steve at holdenweb.com
Tue Oct 26 06:12:24 CEST 2004


Cliff Wells wrote:

> On Mon, 2004-10-25 at 21:48 -0500, Jeff Epler wrote:
> 
>>Here's a bug that passes silently because ints are not limited in range
>>from 1 to 100:
>>    ...
>>
>>OK, just joking.  I couldn't think of one.
> 
> 
> Here's one:
> 
> # count how many ferrets I have
> ferrets = 0
> while 1:
>     try:
>         ferrets += 1
>     except:
>         break
> print ferrets
> 
> As you can clearly see, the answer should have been 3, but due to Python
> silently allowing numbers larger than 3 the program gets stuck in an
> apparently interminable loop, requiring me to reboot Microsoft Bob.
> 
Come on, the answer should clearly have been seven. Don't try your trick 
with ne, buddy. I know octal is the only true number system.

And heaven knows how all those different characters got encoded in 
three-bit bytes. That's got to be tricky.

7-I-can-see-that-ly y'rs  - steve
-- 
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119



More information about the Python-list mailing list