Steven D'Aprano wrote: > On Thu, 18 Mar 2010 07:44:21 am Raymond Hettinger wrote: >> The spectrum of options from worst to best is >> 1) compare but give the wrong answer >> 2) compare but give the right answer >> 3) refuse to compare. > > Why is 3 the best? If there is a right answer to give, surely giving the > right answer it is better than not? I agree with Steven here - for mixed *arithmetic* refusing to get involved is a reasonable choice, because the whole point of Decimals is to get the answers according to base 10 expectations. Allowing implicit conversion of base 2 floats puts that foundation at risk. In what way do comparisons carry the same risk? Decimal.from_float shows that a perfectly adequate mapping from float into the Decimal space can be made, and the comparisons have a clear well-defined answer. It may be slightly confusing to those not familiar with the subtleties of limited precision base 2 vs larger precision base 10, but the boolean result places them in a clearly different category to my mind. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia ---------------------------------------------------------------
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