How about adding rational fraction to Python?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Thu Feb 28 17:41:33 EST 2008


On Thu, 28 Feb 2008 14:41:56 -0500, Ross Ridge wrote:

> You're just going to have to accept that there that there is no
> concensus on this issue and there never was.

But that's not true. The consensus, across the majority of people (both 
programmers and non-programmers alike) is that 1/2 should return 0.5. 
There's a small minority that argue for a rational result, and a bigger 
minority who argue for 0.

The interesting case is -1/2. According to the argument that "2 doesn't 
go into 1", -1/2 should also return 0. But that's not what Python 
returns, so it looks like the "int division" camp is screwed no matter 
whether Python keeps the status quo or the other status quo.


-- 
Steven



More information about the Python-list mailing list