title: Find out variable name of object that caused an exception
body: <p>Let's consider the following code example which I will use to raise an AttributeError as an example.</p>
  
  <pre><code>def test(first, second):
      print("My age is " + first.age + " and my neighbour is " + second.age)
  </code></pre>
  
  <p>Say I have the following class.</p>
  
  <pre><code>class Dummy(object):
      def __init__(self):
          pass
  </code></pre>
  
  <p>If I call the function with</p>
  
  <pre><code>d = Dummy()
  d.__setattr__("age", "25")
  test(d, Dummy())
  </code></pre>
  
  <p>I will get an AttributeError because the second Dummy has no Attribute <code>age</code>. This is caused by <code>second.age</code>. </p>
  
  <p>My question now is if there is a way that I can find out what the name of the variable is that causes the error. Looking at the source code it is obvious that it is <code>second</code>, but how can I find this out in an try except block?</p>