title: Enumerations in python
body: <blockquote>
    <p><strong>Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/36932/whats-the-best-way-to-implement-an-enum-in-python">What&rsquo;s the best way to implement an &lsquo;enum&rsquo; in Python?</a>  </p>
  </blockquote>
  
  <p>Whats the recognised way of doing enumerations in python?</p>
  
  <p>For example, at the moment I'm writing a game and want to be able to move "up", "down", "left" and "right".  I'm using strings because I haven't yet figured out how enumerations work in python, and so my logic is littered with things like this:</p>
  
  <pre><code>def move(self, direction):
      if direction == "up":
          # Do something
  </code></pre>
  
  <p>I want to replace <code>"up"</code> with something like <code>Directions.up</code></p>