title: How should I best emulate and/or avoid enum's in Python?
body: <p>I've been using a small class to emulate Enums in some Python projects. Is there a better way or does this make the most sense for some situations?</p>
  
  <p>Class code here:</p>
  
  <pre><code>class Enum(object):
  '''Simple Enum Class
  Example Usage:
  &gt;&gt;&gt; codes = Enum('FOO BAR BAZ') # codes.BAZ will be 2 and so on ...'''
  def __init__(self, names):
      for number, name in enumerate(names.split()):
          setattr(self, name, number)
  </code></pre>