[Python-Dev] enum discussion: can someone please summarize open issues?

Guido van Rossum guido at python.org
Tue Apr 30 00:18:59 CEST 2013


On Mon, Apr 29, 2013 at 2:45 PM, Terry Jan Reedy <tjreedy at udel.edu> wrote:
> On 4/29/2013 8:24 AM, Eli Bendersky wrote:
>
>> Thanks for the summary. One issue I don't see addressed here is
>> int-compatibility. Am I correct to assume that nothing changes w.r.t.
>> that, and that an IntEnum subclass of Enum will be provided which is
>> isinstance(integer)? Does that become straightforward by nature of enum
>> values being the type of their enumerations?
>
>
> My only concern is that whatever you do does not break transitivity of ==.
> Aside from that, I will be happy with whatever you end up with and use it as
> appropriate.

This is a trick question though, isn't it? Example:

class Color(Enum):
  red = 1
  white = 2
  blue = 3

class State(Enum):
  idle = 0
  busy = 1

We would have State.busy == 1 and Color.red == 1, so now State.busy ==
Color.red.

--
--Guido van Rossum (python.org/~guido)


More information about the Python-Dev mailing list