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:
      raise ValueError('this shouldn't happen!)
  else:
      raise ValueError('unhandled Status: %r' % status)

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

Reply via email to