[Python-Dev] [Python-checkins] peps: Pre-alpha draft for PEP 435 (enum). The name is not important at the moment, as

Ethan Furman ethan at stoneleaf.us
Tue Feb 26 16:33:14 CET 2013


On 02/26/2013 07:01 AM, Terry Reedy wrote:
> On 2/25/2013 6:53 PM, Greg Ewing wrote:
>> The currently suggested solution to that seems to be to
>> make comparison non-transitive, so that Colors.green == 1
>> and Animals.bee == 1 but Colors.green != Animals.bee.
>> And then hope that this does not create a quantum black
>> hole that sucks us all into a logical singularity...
>
> But it will;-).
> To repeat myself, transitivity of equality is basic to thought, logic, and sets and we should not deliver Python with it
> broken. (The non-reflexivity of NAN is a different issue, but NANs are intentionally insane.)
>
> Decimal(0) == 0 == 0.0 != Decimal(0) != Fraction(0) == 0
> was a problem we finally fixed by making integer-valued decimals
> compare equal to the same valued floats and fractions. In 3.3:
>
>>>> from decimal import Decimal as D
>>>> from fractions import Fraction as F
>>>> 0 == 0.0 == D(0) == F(0)
> True
>
> http://bugs.python.org/issue4087
> http://bugs.python.org/issue4090
> explain the practical problems. We should NOT knowingly go down this road again. If color and animal are isolated from
> each other, they should each be isolated from everything, including int.

Thank you, Terry.

--
~Ethan~


More information about the Python-Dev mailing list