Definition of "property"

Alan Gauld alan.gauld at yahoo.co.uk
Mon May 31 15:01:29 EDT 2021


On 31/05/2021 01:24, Greg Ewing wrote:
> On 31/05/21 8:20 am, Alan Gauld wrote:
>>
>> That's a very Pythonic description.
> 
> If it's a book about Python, it needs to be. The word "property"
> has a very specialised meaning in Python.
> 
> In some other languages it's used the way we use "attribute" in
> Python. So a Python-specific definition is necessarily going
> to be very different from a generic one.

That was the point, the OP said it was a book about OOP.
Not a book about "OOP in Python". The two are not synonymous.

If we go back to the very beginnings of OOP, properties were
defined as the publicly available state variables of the object.
(Some others favoured using "properties" to describe the entire
set of messages to which an object could respond).

In classification theory they are defined as "the essential
characteristics of an object that identify it with a class"
Some theorists also insist that such properties be immutable
after instantiation of the object.

The first could be considered quite close to what Python
does(or allows you to do) but the second is quite different!
Although properties can be used to create a form of immutablity.

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