← Back to Python

__getattr__ vs __getattribute__

Pythonpython

The Question

What is the difference between __getattr__ and __getattribute__?

What a Strong Answer Covers

  • __getattribute__ = every access
  • "__getattr__ = only on failure
  • "object.__getattribute__ escape

Related Questions

  • GIL — What It Is and What It Protects
  • ThreadPoolExecutor & ProcessPoolExecutor
  • Decorators — Under the Hood
  • Generators & yield
  • Context Managers

Practice This Question

Get AI-graded feedback on your answer with follow-up probes on weak points.

Take the Free Assessment
GrindQuestionsAITechnical interview assessment
TermsPrivacyAbout