int/long unification hides bugs

John Machin sjmachin at lexicon.net
Tue Oct 26 14:19:07 CEST 2004


Cliff Wells <clifford.wells at comcast.net> wrote in message news:<mailman.5477.1098760532.5135.python-list at python.org>...
> 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.

There always were legends that sys.maxferretpopulation is
implementation-dependant, not readable, and not writable. More
recently the whisper is that at least under Windows it is set by the
installer at installation time using an algorithm known only to the
timbot.



More information about the Python-list mailing list