title: Are there any other ways to iterate through the attributes of a custom class, excluding the in-built ones?
body: <p>Is there another way to iterate through only the attributes of a custom class that are not in-built (e.g. <code>__dict__</code>, <code>__module__</code>, etc.)? For example, in this code:</p>
  
  <pre><code>class Terrain:
      WATER = -1
      GRASS = 0
      HILL = 1
      MOUNTAIN = 2
  </code></pre>
  
  <p>I can iterate through all of these attributes like this:</p>
  
  <pre><code>for key, value in Terrain.__dict__.items():
      print("{: &lt;11}".format(key), " --&gt; ", value)
  </code></pre>
  
  <p>which outputs:</p>
  
  <pre><code>MOUNTAIN     --&gt;  2
  __module__   --&gt;  __main__
  WATER        --&gt;  -1
  HILL         --&gt;  1
  __dict__     --&gt;  &lt;attribute '__dict__' of 'Terrain' objects&gt;
  GRASS        --&gt;  0
  __weakref__  --&gt;  &lt;attribute '__weakref__' of 'Terrain' objects&gt;
  __doc__      --&gt;  None
  </code></pre>
  
  <p>If I just want the integer arguments (a <a href="https://stackoverflow.com/a/36937/869912">rudimentary version</a> of an enumerated type), I can use this:</p>
  
  <pre><code>for key, value in Terrain.__dict__.items():
      if type(value) is int: # type(value) == int
          print("{: &lt;11}".format(key), " --&gt; ", value)
  </code></pre>
  
  <p>this gives the expected result:</p>
  
  <pre><code>MOUNTAIN    --&gt;  2
  WATER       --&gt;  -1
  HILL        --&gt;  1
  GRASS       --&gt;  0
  </code></pre>
  
  <p>Is it possible to iterate through only the non-in-built attributes of a custom class independent of type, e.g. if the attributes are not all integral. Presumably I could expand the conditional to include more types, but I want to know if there are other ways I'm missing. </p>