Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ea9a42

Browse files
committed
Closes #16149: remove now-false statement about the inability to compare Decimal and float objects.
1 parent 1a53c0c commit 7ea9a42

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

Doc/reference/expressions.rst

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,16 +1094,10 @@ Comparison of objects of the same type depends on the type:
10941094
another one is made arbitrarily but consistently within one execution of a
10951095
program.
10961096

1097-
Comparison of objects of the differing types depends on whether either
1098-
of the types provide explicit support for the comparison. Most numeric types
1099-
can be compared with one another, but comparisons of :class:`float` and
1100-
:class:`Decimal` are not supported to avoid the inevitable confusion arising
1101-
from representation issues such as ``float('1.1')`` being inexactly represented
1102-
and therefore not exactly equal to ``Decimal('1.1')`` which is. When
1103-
cross-type comparison is not supported, the comparison method returns
1104-
``NotImplemented``. This can create the illusion of non-transitivity between
1105-
supported cross-type comparisons and unsupported comparisons. For example,
1106-
``Decimal(2) == 2`` and ``2 == float(2)`` but ``Decimal(2) != float(2)``.
1097+
Comparison of objects of the differing types depends on whether either of the
1098+
types provide explicit support for the comparison. Most numeric types can be
1099+
compared with one another. When cross-type comparison is not supported, the
1100+
comparison method returns ``NotImplemented``.
11071101

11081102
.. _membership-test-details:
11091103

0 commit comments

Comments
 (0)