title: hasattr returns attribute error even after exception is captured
body: <p>Here is my sample code to check if the given attribute is present in the class or not.</p>
  
  <pre><code>class EmpDict:
      def __init__(self, data):
          self.data = data
          try:
              self.first_name = data['first_name']
              self.age        = data['age']
              self.last_name  = data['last_month']
          except:
              pass
  
      def is_attr_available(self, attr):
          try:
              hasattr(EmpDict, attr)
              return True
          except:
              return False
  </code></pre>
  
  <p>Here is the test:</p>
  
  <pre><code>&gt;&gt; emp = {'first_name' : 'Tom', 'last_name' : 'Jose'}
  
  &gt;&gt; a = EmpDict(emp)
  &gt;&gt; print(a.is_attr_available(a.first_name)) 
       True
  &gt;&gt; print(a.is_attr_available(a.age))
       print(a.is_attr_available(a.age))
       AttributeError: 'EmpDict' object has no attribute 'age'
  </code></pre>
  
  <p>I expected False for the last statement, instead I get an AttributeError even though I also captured the exception in is_attribute_available method. </p>
  
  <p>Any leads on what I am doing wrong here?</p>