How about adding rational fraction to Python?
tjreedy at udel.edu
Fri Feb 29 23:06:21 CET 2008
"Ross Ridge" <rridge at caffeine.csclub.uwaterloo.ca> wrote in message
news:fq7voj$6v6$1 at rumours.uwaterloo.ca...
| 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.
| Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> wrote:
| >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.
| You're deluding yourself.
As a major participant in the discussion, who initially opposed the change,
I think Steven is right.
| If there were a concensus then this issue then
| it wouldn't be so controversial.
The controversy was initially inflamed by issues that did not directly bear
on the merit of the proposal. Worst was its cloaking it in a metaphysical
argument about the nature of integers. It also did not help that Guido
initially had trouble articulating the *practical*, Pythonic reason for the
To me, the key is this (very briefly): The current overloading of '/' was
copied from C. But Python is crucially different from C in that
expressions can generally be generic, with run-time rather than compile
time typing of variables. But there are no practical use cases that anyone
ever presented for expr_a / expr_b having two different numerical values,
giving fixed numerical values for expr_a and expr_b, depending on the
number types of the two expressions.
Beyond the change itself, another issue was its timing. When I proposed
that the version making 1/2=.5 the default be called 3.0, and Guido agreed,
many who agreed with the change in theory but were concerned with stability
of the 2.x series agreed that that would make it more palatable.
A third issue was the work required to make the change. The future
mechanism eased that, and the 2to3 conversion program will also issue
Terry Jan Reedy
More information about the Python-list