What is the effect of decorating a method with @property?
Correct answer B. The method can be accessed like an attribute, without parentheses
Explanation
property turns a method into a managed attribute, so obj.area calls the getter automatically. Setter and deleter methods can be added with @area.setter and @area.deleter, which allows validation while keeping simple attribute syntax. Caching is what functools.cached_property provides, and privacy is only a naming convention in Python.
Answer checked How we write and check questions
Discussion