Definition of "property"

Mike Dewhirst miked at dewhirst.com.au
Sun May 30 18:57:46 EDT 2021


On 31/05/2021 2:57 am, Irv Kalb wrote:
> I am doing some writing (for an upcoming book on OOP), and I'm a little stuck.
>
> 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.
>
> But I'm hoping that someone here can give me a more concise (one or two sentence) definition of the word "property".

A property is an object method masquerading as a cachable object attribute

>
> (I would like to avoid going through the whole derivation with the property function, as that would distract from the points that I am trying to make.)
>
> Thanks in advance,
>
> Irv


-- 
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://mail.python.org/pipermail/python-list/attachments/20210531/05d84ca9/attachment.sig>


More information about the Python-list mailing list