PEP0238 lament

David Eppstein eppstein at ics.uci.edu
Sun Jul 22 16:07:02 EDT 2001


In article <mailman.995826216.11537.python-list at python.org>,
 "Tim Peters" <tim.one at home.com> wrote:

> By show of hands, about 3/4ths of the
> participants agreed that 3/4 should not return 0, but rather *something* x
> such that x*4 had a better chance of being confused with 3 than with 0.

Well then, float is a very bad choice for what to return, or then how do 
we explain when 3/4 * 4 = 3 (exactly) but 3/10 * 10 != 10?

I would be a lot happier with integer / integer = rational (as in 
Mathematica's programming lang), but float is just ugly.  It is turning 
exact values (integers) into approximate ones (float) when I didn't tell it 
to.  It's almost as bad as if integer subtraction always truncated to 16 
bit values -- a lot of the time that would give sort of reasonable answers 
but it's a gratuitous approximation where you didn't expect one.
-- 
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/



More information about the Python-list mailing list