title: Using an Enum as a flag in a class, Python
body: <p>I would like to use an enum to represent an internal state of a class:</p>
  
  <pre><code>#!/usr/bin/python3
  from enum import Enum
  
  
  class testClass:
      class Color(Enum):
          red = 1
          blue = 2
          green = 3
  
      def __init__(self):
          self.value = 0
  
      def setValue(self, Color):
          self.value = Color
  </code></pre>
  
  <p>this is what I thought could be a possible implementation. The two annoying things that I see are:</p>
  
  <ol>
  <li><p>to set <code>value</code> I have to do :</p>
  
  <p><code>q = testClass()</code></p>
  
  <p><code>q.setValue(q.Color.red)</code></p>
  
  <p>and I find the <code>q.Color.red</code> someway umpleasant, I'd rather have something like:<code>Color.red</code> or just <code>red</code>. Maybe the only way to have that is to use some string comparison, but it is exactly what I am trying to avoid using enum.</p></li>
  <li><p>I get an extra method that is <code>q.Color.mro</code> that seems like an internal method of the enum class. What is this for? </p></li>
  </ol>