Ethan Furman <et...@stoneleaf.us> writes:

> class X(Enum):
>     Falsey = 0
>     Truthy = 1
>     Fakey = 2
>     def __bool__(self):
>         return bool(self.value)

I am surprised this is not already the behaviour of an Enum class,
without overriding the ‘__bool__’ method.

What would be a good reason not to have this behaviour by default for
‘Enum.__bool__’? (i.e. if this were reported as a bug on the ‘enum.Enum’
implementation, what would be good reasons not to fix it?)

-- 
 \     “As scarce as truth is, the supply has always been in excess of |
  `\                                       the demand.” —Josh Billings |
_o__)                                                                  |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to