Using fractions instead of floats

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Thu Oct 4 05:37:59 EDT 2007


On Mon, 01 Oct 2007 09:09:21 -0700, Arnaud Delobelle wrote:

> As pointed out by others, implementations of rationals in Python abound.
> Whereas there is a canonical representation of floats and ints (and even
> longints) in the machine, it is not the case for rationals. Moreover
> most programming tasks do not need rationals, so why burden the language
> with them? If one needs them, there are perfectly adequate modules to
> import (even though I, like many others I suspect, have my own
> implementation in pure Python).  Finally, arithmetic would become very
> confusing if there were three distinct numeric types; it already causes
> enough confusion with two!

Or, to put it another way:


As pointed out by others, implementations of sets in Python abound. 
Whereas there is a canonical representation of floats and ints in the 
machine, it is not the case for sets. Moreover most programming tasks do 
not need sets, so why burden the language with them? If one needs them, 
there are perfectly adequate modules to import (even though I, like many 
others I suspect, have my own implementation in pure Python).  Finally, 
programming would become very confusing if there were three distinct 
sequence types; it already causes enough confusion with two!



-- 
Steven.



More information about the Python-list mailing list