A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-July/016260.html below:

[Python-Dev] A future division proposal

[Python-Dev] A future division proposal [Python-Dev] A future division proposalMoore, 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.



RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4