On Sat, May 26, 2018 at 2:46 PM, Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> wrote: > Am I silly for wanting to make a single enum? > > I have a three-state flag, True, False or Maybe. Is is confusing or bad > practice to make a single enum for the Maybe case? > > > from enum import Enum > class State(Enum): > Maybe = 2 > > Maybe = State.Maybe > del State > > Is there a better way of handling a three-state flag like this? >
Does it need to have a value of 2? If not: # Tri-state logic Maybe = object() Though I have to say, you picked the wrong name for the third state. Everyone knows it should be File_Not_Found. ChrisA -- https://mail.python.org/mailman/listinfo/python-list