[New-bugs-announce] [issue30517] Enum does not recognize enum.auto as unique values

Max report at bugs.python.org
Tue May 30 22:08:08 EDT 2017


New submission from Max:

This probably shouldn't happen:

    import enum

    class E(enum.Enum):
      A = enum.auto
      B = enum.auto

    x = E.B.value
    print(x) # <class 'enum.auto'>
    print(E(x))  # E.A

The first print() is kinda ok, I don't really care about which value was used by the implementation. But the second print() seems surprising.

By the same token, this probably shouldn't raise an exception (it does now):

    import enum

    @enum.unique
    class E(enum.Enum):
      A = enum.auto
      B = enum.auto
      C = object()

and `dir(E)` shouldn't skip `B` in its output (it does now).

----------
components: Library (Lib)
messages: 294804
nosy: max
priority: normal
severity: normal
status: open
title: Enum does not recognize enum.auto as unique values
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30517>
_______________________________________


More information about the New-bugs-announce mailing list