title: How do you set a conditional in python based on datatypes?
body: <p>This question seems mind-boggling simple, yet I can't figure it out. I know you can check datatypes in python, but how can you set a conditional based on the datatype? For instance, if I have to write a code that sorts through a dictionary/list and adds up all the integers, how do I isolate the search to look for only integers? </p>
  
  <p>I guess a quick example would look something like this:</p>
  
  <pre><code>y = []
  for x in somelist:
      if type(x) == &lt;type 'int'&gt;:  ### &lt;--- psuedo-code line
      y.append(x)
  print sum(int(z) for z in y)
  </code></pre>
  
  <p>So for line 3, how would I set such a conditional?</p>