David Rebbe <ic3m...@gmail.com> added the comment:

Thank you for referencing the PEP, I just managed to read through it and I 
still don't have a very good understanding why it needs to default to 1. PEP 
435 states:

"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."

I can't find anything in the PEP that states why enum members need to evaluate 
to True. What am I missing here?

I was specifically tripped up with the generator I wrote that takes a C header 
and converts it to python ctype/enum objects. I have fixed the issue so its not 
a show stopper by any means its just not expected behavior for anyone with 
programming experience with enums outside Python. 

Here is the project in question where I discovered this:
https://github.com/intrepidcs/python_ics/issues/105

enum in question:
https://github.co/intrepidcs/python_ics/blob/master/ics/structures/e_device_settings_type.py
which is generated from this:
https://github.com/intrepidcs/python_ics/blob/master/include/ics/icsnVC40.h#L3410


Maybe it would be better to have an Enum type in the ctypes module instead to 
match all other language enums?

----------

_______________________________________
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

Reply via email to