On Fri, 28 Jul 2017 05:52 pm, Ethan Furman wrote:

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

Thanks Ethan.

Like Ben, I'm surprised that's not the default behaviour.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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

Reply via email to