Ideally, I think the better way is if getattr, when raising AttributeError, somehow reused the old traceback (which would point out the original problem). I don't know how to do that, though.
Maybe a solution could be to put the attribute name in the AttributeError exception object, and use it in getattr; if the name doesn't match, the exception is re-raised. It's still not flawless, but would reduce risk of errors.
Nicolas -- http://mail.python.org/mailman/listinfo/python-list