On Wed, Mar 4, 2020 at 4:08 PM David Mertz <[email protected]> wrote:

>
> And I'm also fudging the Decimal question too.  The relationship between
> *expressions* can vary by decimal context.  But not of a value named by a
> single variable.
>

Right: Decimal objects don't know anything about context, and comparisons
of Decimal objects don't make use of the context, so if we ignore NaNs,
then any set of Decimal objects is totally orderable. So Decimal is totally
orderable to exactly the same extent that float is. (Though the behaviour
with NaNs is a little more extreme, since comparisons involving sNaNs will
raise rather than return False.)

I'd argue that on a practicality-beats-purity basis, it wouldn't be
unreasonable to register both `Decimal` and `float` as implementing
`TotalOrdering` (or whatever the ABC ends up being called).

-- 
Mark
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/EQOB6O6XRC2GFXUYKCRLVW2PNFNPULM3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to