Re: bool(Enum) should raise ValueError

2019-07-28 Thread Ethan Furman
On 07/28/2019 01:46 PM, Erik Aronesty wrote: One possibility --- class Status: valid = 1 invalid = 2 unknown = 3 if status is Status.valid: # good status, do something elif status is Status.unknown: figure_out_status() elif status is Status.invalid:

Re: bool(Enum) should raise ValueError

2019-07-28 Thread Erik Aronesty
class Status: valid = 1 invalid = 2 unknown = 3 On Fri, Jul 26, 2019, 3:37 PM Chris Angelico wrote: > On Sat, Jul 27, 2019 at 5:16 AM Erik Aronesty wrote: > > > > I just spend a while tracking down and killing all "if Enum" and "if not > > Enum" bugs in my code. I was frankly shocked

Re: bool(Enum) should raise ValueError

2019-07-26 Thread Chris Angelico
On Sat, Jul 27, 2019 at 5:16 AM Erik Aronesty wrote: > > I just spend a while tracking down and killing all "if Enum" and "if not > Enum" bugs in my code. I was frankly shocked that this didn't raise a > ValueError to begin with. > > Apparently all enums are true/false depending on whether the u

Re: bool(Enum) should raise ValueError

2019-07-26 Thread Ethan Furman
On 07/26/2019 11:56 AM, Erik Aronesty wrote: I just spend a while tracking down and killing all "if Enum" and "if not Enum" bugs in my code. I was frankly shocked that this didn't raise a ValueError to begin with. Very few items, if any, raise a ValueError when asked for its True/False equi