A RetroSearch Logo

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

Search Query:

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

[Python-Dev] A future division proposal

[Python-Dev] A future division proposal [Python-Dev] A future division proposalSkip Montanaro skip@pobox.com (Skip Montanaro)
Wed, 25 Jul 2001 12:48:51 -0500
    Paul> Actually, when I tried, I got into a bit of a mess getting the
    Paul> type checks (which you need) right -

    Paul>     def olddiv(n,m):
    Paul>         if type(n) == type(m) == type(0):
    Paul>             return n//m
    Paul>         else:
    Paul>             return n/m

    Paul> But this needs the checks expanded to take longs into
    Paul> account. Which is where it gets messy.

Wouldn't this work for ints and longs?

    def olddiv(n,m):
        ints = [type(0), type(0L)]
        if type(n) in ints and type(m) in ints:
            return n//m
        else:
            return n/m

-- 
Skip Montanaro (skip@pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/



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