decimal or rational (was Re: Against PEP 240)

Alex Martelli aleaxit at
Thu May 31 09:27:52 EDT 2001

"Laura Creighton" <lac at> wrote in message
news:mailman.991303187.29241.python-list at
> <And thanks to more conversation with Remco Gerlich I think that it
> is decimal, not rational that is the way to go, somebody try to talk us
> out of it>  is exactly what Burke was talking about.

I'm not a candidate for "talking (anybody) out of it", where
"it" is having (e.g.) 7.35 mean a floating-point-decimal 7.35
rather than a rational 7.35, because I'm _deeply_ undecided
myself.  My criterion: what *WOULD* be harder to explain to (and
have accepted by) an intelligent beginner?  Potentially *VERY
SLOW* (and memory-consuming) behavior for computation, or the
risk of unexpected (to said beginner) 'strange' results?  And
I'm not talking about a vacuum -- I'm talking about a real-world
where people's expectations ARE very much shaped by the
calculators they've dealt with for years, and those ARE FP
decimal (at least typically).  A computation doesn't slow
down as it proceeds, but it does often lose precision...

Non-beginners shouldn't be much of an issue -- we're all able
to write 7.35r for rational, or 7.35f for binary floating
point, or 7.35d for decimal floating point, or whatever other
kind of syntax sugar is chosen for decorations.  But 7.35,
undecorated, should be interpreted in ONE way (no context
dependencies, no options except perhaps transiently for the
purpose of facilitating migrations, seems to be Pythonic).
WHICH one way?  Moshe, I believe, was the one specifically
arguing for rational -- is he around maybe to comment...?


More information about the Python-list mailing list