[Python-Dev] Boolean value of an Enum member (original) (raw)

Barry Warsaw barry at python.org
Fri Jan 15 13:32:58 EST 2016


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



More information about the Python-Dev mailing list