I have no preference in how this is exposed in Python, I just wanted to express my interest in having such functionality implemented natively.
You are right, sorry for my confusion. Citing from docs of hasattr:
This is implemented by calling
getattr(object, name)and seeing whether it raises anAttributeErroror not.
I expect no more-performant yet consistent implementation can be made. But still, if it was worth it to have hasattr implemented as a built-in function, a nested variant would make sense just out of pure consistency (if such getattr is implemented). Even if it was a simple try/except block with returns of booleans.