Question
Which statement about Dunder Methods and Data Model Protocols is the strongest interview answer?
- Dunder Methods and Data Model Protocols is mostly a naming style choice and has little effect on runtime behavior or design tradeoffs.
- Dunder methods let user-defined objects participate in Python protocols such as printing, equality, iteration, or ordering.
- Dunder Methods and Data Model Protocols exists mainly to reduce the number of files in a Python project.
- Dunder Methods and Data Model Protocols matters only for frontend scripting and not for backend or automation code.
Hint
Start with the core rule behind Dunder Methods and Data Model Protocols.
Answer and rationale
Correct answer: B. Dunder methods let user-defined objects participate in Python protocols such as printing, equality, iteration, or ordering.
Dunder methods let user-defined objects participate in Python protocols such as printing, equality, iteration, or ordering. This is the base concept interviewers commonly test first.
Track: Python