Skip to content
Sharp

Python Internals · interview question

A bug appears around dunder methods. What is the strongest first debugging move?

Multiple choiceMediumchapter-19-curatedpremiumpython-internalsdunder-methods
python
class Order:
    def __repr__(self) -> str:
        return "Order(id='ORD-1')"
Choose one answer
Answer and explanation

Correct answer

D. Trace one concrete example, inspect the state transitions, and compare them to the intended rule before rewriting anything.

Why

That approach is reliable because it creates evidence. Adding dunder methods without a clear behavioral contract can make the model more confusing rather than more Pythonic.

Test yourself on Python Internals

A free test with instant, explained results. No account needed.

Start free test
All Python Internals questions →