title: Convert enum to int in python
body: <p>I have an enum Nationality:</p>
  
  <pre><code>class Nationality:
          Poland='PL'
          Germany='DE'
          France='FR'
  </code></pre>
  
  <p>How can I convert this some enum to int in this or similar way: </p>
  
  <pre><code>position_of_enum = int(Nationality.Poland)  # here I want to get 0
  </code></pre>
  
  <p>I know that I can do it if I had code by:</p>
  
  <pre><code>counter=0
  for member in dir(Nationality):
      if getattr(Nationality, member) == code:
          lookFor = member
          counter += 1
  return counter
  </code></pre>
  
  <p>but I don't have, and this way looks too big for python. I'm sure that there is something much simpler .</p>