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