Kaydet (Commit) 4614cc4f authored tarafından Georg Brandl's avatar Georg Brandl

Closes #16149: remove now-false statement about the inability to compare Decimal and float objects.

üst b2209ccf
...@@ -1067,16 +1067,10 @@ Comparison of objects of the same type depends on the type: ...@@ -1067,16 +1067,10 @@ Comparison of objects of the same type depends on the type:
another one is made arbitrarily but consistently within one execution of a another one is made arbitrarily but consistently within one execution of a
program. program.
Comparison of objects of the differing types depends on whether either Comparison of objects of the differing types depends on whether either of the
of the types provide explicit support for the comparison. Most numeric types types provide explicit support for the comparison. Most numeric types can be
can be compared with one another, but comparisons of :class:`float` and compared with one another. When cross-type comparison is not supported, the
:class:`Decimal` are not supported to avoid the inevitable confusion arising comparison method returns ``NotImplemented``.
from representation issues such as ``float('1.1')`` being inexactly represented
and therefore not exactly equal to ``Decimal('1.1')`` which is. When
cross-type comparison is not supported, the comparison method returns
``NotImplemented``. This can create the illusion of non-transitivity between
supported cross-type comparisons and unsupported comparisons. For example,
``Decimal(2) == 2`` and ``2 == float(2)`` but ``Decimal(2) != float(2)``.
.. _membership-test-details: .. _membership-test-details:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment