[issue44993] enum.auto() starts with one instead of zero

Ethan Furman report at bugs.python.org
Wed Aug 25 15:25:09 EDT 2021


Ethan Furman <ethan at stoneleaf.us> added the comment:

David, I added a PR for the Enum handling/creation in the ics library.  Syncing values with external libraries is definitely *not* what `auto` is intended for.

As for why enum members evaluate as True:  most objects in Python evaluate to True, unless they have a reason not to (such as an empty container or the number 0).  One of the main ideas behind the creation of Enum is that the exact values didn't usually matter,  but when they did they would be specified.  `auto()` was added later to make the "doesn't usually matter" case easier.

---

Vedran, or `cEnum`?  ;-)

One concern is should cEnum be Python's `int`, or a c_type int?  That should be in a new issue, though.

Okay, it's Issue45004.

----------
stage:  -> resolved

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44993>
_______________________________________


More information about the Python-bugs-list mailing list