Definition of "property"

Alan Gauld alan.gauld at yahoo.co.uk
Sun May 30 16:20:24 EDT 2021


On 30/05/2021 17:57, Irv Kalb wrote:
> I am doing some writing (for an upcoming book on OOP), and I'm a little stuck.  

Oh dear, that's one of myt hot buttons I'm afraid!
I hope it really is about OOP and not about classes. Classes
are such a minor part of OOP that it is depressing how many
books and articles focus on them to the exclusion of all
else that make up the OOP paradigm! Anyway, rant over...

> I understand what a "property" is, how it is used and the benefits, 

Do you? What is that based on? Is it how properties are used in OOP?
Or how they are used in Python? Is your book truly about OOP or
how Python does OOP (very different things!) How do python
properties compare to properties in other languages like
Object Pascal(aka Delphi) and Eiffel for example?
Which of these 3 options most closely models the pure OOP
concept of a property?

> definition of property.  

In OOP or in Python? Or both?

> 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. 

That's a very Pythonic description.

> (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.) 

Which are?
Hopefully, about abstraction of data and function/methods
therby encouraging polymorphic representations of program structures,
which is the essence of OOP.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Python-list mailing list