Tim Peters wrote: > Do note that this discussion is only about Python 3. Under the view > that it was a (minor, but real) design error to /try/ extending > Python's integer mod definition to floats, if __mod__, and __divmod__ > and __floordiv__ go away for binary floats in P3K they should > certainly go away for decimal floats in P3K too. What design error? float.__mod__ works perfectly. >>> -1 % 50 49 >>> -1.0 % 50.0 49.0 >>> It's only Decimal.__mod__ that's inconsistent. float.__mod__ has the usual floating-point inaccuracies, but then with float that goes with the territory. I've had occasion to use it, and it was a pleasant surprise that it "just worked", so I didn't have to go to the math module and ponder over the difference between modulo or remainder. float modulo is useful, consistent and intuitive; -1 on removing that. - Anders
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