[Python-Dev] Boolean value of an Enum member
Barry Warsaw
barry at python.org
Fri Jan 15 13:32:58 EST 2016
More information about the Python-Dev mailing list
Fri Jan 15 13:32:58 EST 2016
- Previous message (by thread): [Python-Dev] [Python-ideas] Boolean value of an Enum member
- Next message (by thread): [Python-Dev] [Python-ideas] Boolean value of an Enum member
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Jan 15, 2016, at 10:22 AM, Ethan Furman wrote: >So the question now is: for a standard Enum (meaning no other type besides >Enum is involved) should __bool__ look to the value of the Enum member to >determine True/False, or should we always be True by default and make the >Enum creator add their own __bool__ if they want something different? The latter. I think in general enums are primarily a symbolic value and don't have truthiness. It's also so easy to override when you define the enum that it's not worth changing the current behavior. Cheers, -Barry
- Previous message (by thread): [Python-Dev] [Python-ideas] Boolean value of an Enum member
- Next message (by thread): [Python-Dev] [Python-ideas] Boolean value of an Enum member
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list