HELP: restore my faith in Python

Ken Seehof kens at sightreader.com
Fri Mar 10 05:40:02 EST 2000


Okay.  You are right.  Better yet let's make sure floats Never work
correctly.  The more they work right, the more people will think they
work right.  We should have a special case for 1/2.  Obviously, 1/2
should be 7.392.

Also, there should be a limit on the size of lists of 100 items (beyond
which
the program should dump core).  If people can have over 100 items in
a list, they might think they can have several trillion, which would
overflow
memory.

Mirko Liss wrote:

> Ken Seehof wrote:
> >
> > Seems to me an improvement would be to have python artificially
> > add epsilon to floats before converting to int.  This would still
> > suck but IMHO it would suck less.
>
> It's not just the conversion to int. As soon as you tell the
> programmer not to expect the worst from floats, he'll invent
> other ways to make a mess with those ugly floating point numbers.
>
> Want an example?
>
> >>> pennies1, pennies2 = 3.0 / 20 , 3 * 0.05
> >>> menu = { pennies1 : "spam" }
> >>> menu[pennies2] =  "lobster"
> >>> menu
> {0.15: 'lobster', 0.15: 'spam'}
>
> Ooops !
> So the division 3.0/20 is just a bit inaccurate, isn't it?
> But who cares, as long as I get at the sea food.
> So I count my pennies and ...
>
> >>> menu[0.15]
> 'spam'
>
> Spicy regards,
>
> Mirko
>
> --
> M Liß, n89553 at squid.upb.de






More information about the Python-list mailing list