title: Booleans have two possible values. Are there types that have three possible values?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/36932/whats-the-best-way-to-implement-an-enum-in-python">What&#39;s the best way to implement an &#39;enum&#39; in Python?</a>  </p>
  </blockquote>
  
  
  
  <p>I’m writing a function that, ideally, I’d like to return one of three states: “yes”, “no”, and “don’t know”.</p>
  
  <ol>
  <li><p>Do any programming languages have a type that has three, and only three states? Like a boolean, but with three states instead of two?</p></li>
  <li><p>In languages that don’t have such a type (like Python), what’s the best type to represent this?</p>
  
  <p>Currently I think I’ll go with an integer (<code>0</code> for “no”, <code>1</code> for “don’t know” and <code>2</code> for “yes”), but maybe there’s a better way? Integers seem a bit “magic number”.</p>
  
  <p>I could return <code>True</code>, <code>False</code> or <code>None</code>, but as <code>None</code> would evaluate to <code>False</code> in most comparison contexts it seems a bit ripe for errors.</p></li>
  </ol>