[Python-ideas] Boolean value of an Enum member

Ethan Furman ethan at stoneleaf.us
Sat Jan 16 13:17:56 EST 2016


On 01/16/2016 01:56 AM, Stephen J. Turnbull wrote:

 > I don't understand why this was cross-posted.  Python-Dev removed from
 > addressees.

Not every one reads both lists, and I wanted the widest audience.


 > Ethan Furman writes:

 >> However, if the Enum is combined with some other type (str, int,
 >> float, etc), then most behaviour is determined by that type --
 >> including boolean evaluation.  So the empty string, 0 values, etc,
 >> will cause that Enum member to evaluate as False.
 >
 > Do you have a use case where that distinction seems totally
 > inappropriate, or have you merely been bitten by Emerson's Hobgoblin?
 >
Sadly, it was of failing memory.

--
~Ethan~


More information about the Python-ideas mailing list