Steven D'Aprano wrote: > But no such problems arise with comparisons, which will always return a > bool, and will avoid the current ... interesting ... behaviour. In 3.1: > >>>> Decimal(1) == 1 == 1.0 > True >>>> Decimal(1) == 1.0 > False >>>> Decimal.from_float(1.0) == 1 == 1.0 > True >>>> Decimal.from_float(1.0) == 1.0 > False > > Replacing False with an exception doesn't make it any less bizarre. Allowing the comparisons also doesn't introduce the potential for large cumulative errors which are possible when actual implicit arithmetic conversions are allowed. 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