Comment on PEP-0238

Bill Janssen janssen at parc.xerox.com
Tue Jul 10 21:44:08 EDT 2001


Actually, if you're going to go in this direction, why not do what I
proposed for HTTP-NG, which is to use a "denominator" rather than a
decimal precision?  The denominator implicitly specifies the precision.

So, if I want two decimal places, I specify "denominator 100", which
mean that the result will be figured in hundredths.  This easily
allows one to work in 16ths, 3rds, or other fractional amounts.

>>> denominator 100
>>> print 2/7        #-> 0.28
>>> denominator 7
>>> print 2/7        #-> 0.285714285714...

This is, of course, just another use of rationals, since the
denominator used must be stored with each value.

At the very least, if you use "precision" to mean decimal precision,
use "decimal_precision".

Bill





More information about the Python-list mailing list