Ethan Furman <et...@stoneleaf.us> added the comment:
Firstly (or Zeroithly ;) my apologies for not noticing this earlier. In the functional API section: ------------------------------ The reason for defaulting to 1 as the starting number and not 0 is that 0 is False in a boolean sense, but enum members all evaluate to True. --- To the best of my knowledge, Python Enums are different from other languages' enums in several respects; apparently this is one of them. Having the default first value be 1 has been there since the beginning, and isn't going to change now. Rather than allowing numbers to be assigned using the function that says the assigned number doesn't matter, I would rather add `start=x` in the header, the way I have it in `aenum`: from aenum import Enum, auto class ZeroEnum(Enum, start=0): nothing = auto() something = auto() list(ZeroEnum) # [<ZeroEnum.nothing: 0>, <ZeroEnum.something: 1>] class ZeroBaseEnum(Enum, start=0): pass class ZeroEnum2(ZeroBaseEnum): nothing = auto() something = auto() list(ZeroEnum2) # [<ZeroEnum2.nothing: 0>, <ZeroEnum2.something: 1>] Whether the `0` goes in the header, or in auto (which it isn't), people will still need to read the docs to find out about it (unless somebody asks an SO question, of course). ---------- assignee: -> ethan.furman resolution: -> not a bug _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44993> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com