[Python-Dev] A future division proposal
Moore, Paul
Paul.Moore@atosorigin.com
Wed, 25 Jul 2001 16:53:45 +0100
> I don't know what the best name or symbol would be
> (olddiv, ///?) and admittedly it is ugly to have 3
> division operators. But the alternatives seem far,
> far uglier. Isn't this a case where practicality
> beats purity (for keywords or operators)?
You could probably write a function to do this. There's no need for anything
built into Python.
Actually, when I tried, I got into a bit of a mess getting the type checks
(which you need) right -
def olddiv(n,m):
if type(n) == type(m) == type(0):
return n//m
else:
return n/m
But this needs the checks expanded to take longs into account. Which is
where it gets messy.
But:
a) It can be done, and
b) The fact that it's messy probably exposes what's wrong with the old
semantics quite well :-)
Paul.