Skip to content
Sharp

Python Internals · interview question

A bug appears around properties and descriptors. What is the strongest first debugging move?

Multiple choiceHardchapter-19-curatedpremiumpython-internalsproperties-and-descriptors
python
class InventoryItem:
    @property
    def available(self) -> bool:
        return self.stock > 0
Choose one answer
Answer and explanation

Correct answer

B. 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. Treating properties as hidden business workflows can make simple reads unexpectedly expensive or stateful.

Test yourself on Python Internals

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

Start free test
All Python Internals questions →