> On May 30, 2021, at 10:15 AM, Jon Ribbens via Python-list
> <python-list@python.org> wrote:
>
> On 2021-05-30, Irv Kalb <i...@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.
Thank you to everyone who made suggestions of a definition of a property. I
will go with a definition based on this one from Jon R, with the clarification
from Terry R.
Yes, the upcoming book is on object-oriented programing using Python, and goes
into detail about the concepts behind OOP. The unique approach is that I use
pygame and explain how to build a number of user interface "widgets" (like
buttons, text input and output boxes, draggers, etc.) to show the fundamentals
of OOP in a highly visible way. I use these widgets to implement a number of
small games that also incorporate some additional classes like timers,
animation, etc.
Irv
--
https://mail.python.org/mailman/listinfo/python-list