Skip to content
Preptima
hardConceptCodingMidSeniorStaff

What is a descriptor, and how does @property use one?

A Python descriptor implements __get__, and optionally __set__ or __delete__, to control attribute access; @property is a data descriptor that wins over the instance dictionary.

5 min readUpdated 2026-08-15

Answer

Short answer

A descriptor is a class attribute that participates in attribute lookup through get, set or delete. @property uses that protocol as a data descriptor, which is why assigning an instance attribute cannot simply shadow it.

Keep descriptors explicit in the answer because that is the concept the interviewer is actually trying to test. A good descriptors explanation names the trade-off, the failure mode, and the evidence you would use before choosing.

Was this answer helpful?

Likely follow-ups

  • Why can an instance attribute shadow a cached_property but not a property?
  • What does __set_name__ save you from writing, and what did people do before it?
  • Why does cached_property fail on a class that defines __slots__?
  • When is a descriptor a better answer than validating in __init__ or __post_init__?

Related questions

Further reading

Related Topics