<div dir="ltr">Hi everyone,<div><br></div><div>A while back I had a conversation with some folks over on python-list. I was having issues implementing error handling of `AttributeError`s using `__getattr__`.</div><div><br></div><div>My problem is that it is currently impossible for a `__getattr__` in Python to know which method raised the `AttributeError` that was caught by `__getattr__` if there are nested methods.</div><div><br></div><div>For example, we cannot tell the difference between `A.x` not existing (which would raise an AttributeError) and some attribute inside `A.x` not existing (which also raises an AttributeError).  This is evident from the stack trace that gets printed to screen, but `__getattr__` doesn't get that stack trace.</div><div><br></div><div>I propose that the error that triggers an `AttributeError` should get passed to `__getattr__` (if `__getattr__` exists of course).  Then, when handling errors, users could dig into the problematic error if they so desire.</div><div><br></div><div>What do you think?<br><br>Best,</div><div>Jason</div></div>