Comparisons and sorting of a numeric class....
ian.g.kelly at gmail.com
Fri Jan 23 17:50:54 CET 2015
On Fri, Jan 23, 2015 at 8:31 AM, Rustom Mody <rustompmody at gmail.com> wrote:
> Can you tell me what of the following code does not satisfy your requirements?
> [Needs python 3.4]
>>>> from enum import IntEnum
>>>> class B4(IntEnum):
> F1 = 0
> F2 = 0
> F3 = 0
> T = 1
This strikes me as a potential problem:
>>> B4.F1 is B4.F2 is B4.F3
[<B4.F1: 0>, <B4.T: 1>]
Enum members with the same values are just aliases for one another,
not distinct entities.
More information about the Python-list