Definition of "property"
Jon Ribbens
jon+usenet at unequivocal.eu
Sun May 30 13:15:00 EDT 2021
On 2021-05-30, Irv Kalb <Irv at furrypants.com> wrote:
> I understand what a "property" is, how it is used and the benefits,
> but apparently my explanation hasn't made the light bulb go on for my
> editor. The editor is asking for a definition of property. I've
> looked at many articles on line and a number of books, and I haven't
> found an appropriate one yet.
>
> I have written some good examples of how it works, but I agree that a
> definition up front would be helpful. I have tried a number of times,
> but my attempts to define it have not been clear. Perhaps the best
> I've found so far is from the Python documentation:
>
> A property object has getter, setter, and deleter methods usable as
> decorators that create a copy of the property with the corresponding
> accessor function set to the decorated function.
A property is an attribute of a class that pretends to be a data
attribute but in fact causes methods to be called when it is
accessed.
More information about the Python-list
mailing list