Against PEP 240

Alex Martelli aleaxit at yahoo.com
Tue May 29 20:56:13 CEST 2001


"Roman Suzi" <rnd at onego.ru> writes:
    ...
> So, rationale type will help. BUT NOT AS A REPLACEMENT FOR
> FLOAT.

No!  Speed issues will often preclude it (though, if you're coding
numeric stuff that must be fast, you're probably using Numeric
rather than pure Python...).  But what we're specifically discussing 
is what interpretation should ideally be given to an unadorned
numeric literal 7.35.  We might have two adorned ones, say
7.35r to explicitly specify rational and 7.35f to explicitly specify
float, just as 7.35j specifies imaginary.  But *what should the
default be* in the unadorned case?  Given the complications of
floating point, I think having the _default_ mean floating point
would be wrong (it may have to be for backwards compatibility,
but I hope it doesn't...).  Surely only those who explicitly ask to
brave the choppy waters of floating point should be led there,
NOT poor untutored users who'll be forever wondering why they
WRITE 7.35 but 'the computer' insists it's 7.3499999999999996
instead...!  Let's have 7.35 MEAN 7.35, I urge... and that means
either rationals or base-10 floats (I think rationals would be better,
as base>2 only makes things even subtler/trickier for floats...:-).


Alex



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com





More information about the Python-list mailing list