Intermediate Python
Q83 / 101

What is __getattr__ vs __getattribute__?

Correct! Well done.

Incorrect.

The correct answer is B) __getattribute__ is called on every attribute access; __getattr__ is only called when normal lookup fails

B

Correct Answer

__getattribute__ is called on every attribute access; __getattr__ is only called when normal lookup fails

Explanation

Override __getattribute__ to intercept all attribute access (risky). Override __getattr__ for a fallback when normal lookup fails — safer and more common.

Progress
83/101