Re: Definition of "property"

2021-06-02 Thread George Fischhof
Greg Ewing ezt írta (időpont: 2021. jún. 2., Sze, 4:01): > On 1/06/21 7:01 am, Alan Gauld wrote: > > That was the point, the OP said it was a book about OOP. > > Not a book about "OOP in Python". > > In that case it would be best to avoid the word, or give > a definition of the way he's using it,

Re: Definition of "property"

2021-06-01 Thread Greg Ewing
On 1/06/21 7:01 am, Alan Gauld wrote: That was the point, the OP said it was a book about OOP. Not a book about "OOP in Python". In that case it would be best to avoid the word, or give a definition of the way he's using it, making it clear that it's not a universal definition. Python's definit

Re: Definition of "property"

2021-06-01 Thread Alan Gauld via Python-list
On 31/05/2021 15:59, Dennis Lee Bieber wrote: > On Sun, 30 May 2021 21:20:24 +0100, Alan Gauld via Python-list > declaimed the following: > >> 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 o

Re: Definition of "property"

2021-06-01 Thread Eryk Sun
On 6/1/21, Jon Ribbens via Python-list wrote: > > I already answered that in the post you are responding to, but you > snipped it: You can tell something's definitely not a data attribute > if you have to put brackets after its name to call it as a method to > invoke its function or retrieve the v

Re: Definition of "property"

2021-06-01 Thread Jon Ribbens via Python-list
On 2021-06-01, Greg Ewing wrote: > On 1/06/21 2:34 am, Jon Ribbens wrote: >> From the outside, it's just a *data* attribute. Which, from the inside, >> it isn't. Hence "pretending". > > But what is it about the external appearance that would make > you think it's a data attribute, rather than som

Re: Definition of "property"

2021-06-01 Thread Greg Ewing
On 1/06/21 2:34 am, Jon Ribbens wrote: From the outside, it's just a *data* attribute. Which, from the inside, it isn't. Hence "pretending". But what is it about the external appearance that would make you think it's a data attribute, rather than some other kind of attribute? (I'm assuming th

Re: Definition of "property"

2021-06-01 Thread Alan Gauld via Python-list
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 "attribut

Re: Definition of "property"

2021-06-01 Thread Jon Ribbens via Python-list
On 2021-05-31, Greg Ewing wrote: > On 31/05/21 9:13 am, Jon Ribbens wrote: >> No, I said it pretends to be a *data* attribute. > > I don't think it's pretending to be anything. From the outside, > it's just an attribute. >From the outside, it's just a *data* attribute. Which, from the inside, it

Re: Definition of "property"

2021-05-31 Thread Irv Kalb
>> 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 >> defi

Re: Definition of "property"

2021-05-31 Thread Greg Ewing
On 31/05/21 9:13 am, Jon Ribbens wrote: No, I said it pretends to be a *data* attribute. I don't think it's pretending to be anything. From the outside, it's just an attribute. Data attributes are more common than non-data attributes, so we tend to assume that an attribute is a data attribute

Re: Definition of "property"

2021-05-31 Thread Greg Ewing
On 31/05/21 4:57 am, Irv Kalb wrote: 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.

Re: Definition of "property"

2021-05-31 Thread Greg Ewing
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 nece

Re: Definition of "property"

2021-05-31 Thread Alan Gauld via Python-list
On 30/05/2021 23:57, Mike Dewhirst wrote: > > A property is an object method masquerading as a cachable object attribute Or a group of methods perhaps? -- 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 Fli

Re: Definition of "property"

2021-05-31 Thread Jon Ribbens via Python-list
On 2021-05-30, Terry Reedy wrote: > Note: at least one person says a property *pretends* to be an attribute. No, I said it pretends to be a *data* attribute. It is effectively several methods in a trenchcoat pretending to be a variable. -- https://mail.python.org/mailman/listinfo/python-list

Re: Definition of "property"

2021-05-30 Thread Eryk Sun
On 5/30/21, Ethan Furman wrote: > > > Properties are a special kind of attribute. Basically, when Python > encounters the following code: > > > > spam = SomeObject() > > print(spam.eggs) > > > > it looks up eggs in spam, and then examines eggs to see if it has a > __get__, __set__, o

RE: Definition of "property"

2021-05-30 Thread Avi Gross via Python-list
-list On Behalf Of Alan Gauld via Python-list Sent: Sunday, May 30, 2021 4:20 PM To: python-list@python.org Subject: Re: Definition of "property" 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, tha

Re: Definition of "property"

2021-05-30 Thread Dan Stromberg
b 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

Re: Definition of "property"

2021-05-30 Thread Mike Dewhirst
tor 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 tim

Re: Definition of "property"

2021-05-30 Thread dn via Python-list
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

Re: Definition of "property"

2021-05-30 Thread Alan Gauld via Python-list
y 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

Re: Definition of "property"

2021-05-30 Thread Terry Reedy
tor 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 tim

Re: Definition of "property"

2021-05-30 Thread Jon Ribbens via Python-list
On 2021-05-30, Irv Kalb 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 articl

Re: Definition of "property"

2021-05-30 Thread Ethan Furman
On 5/30/21 9:57 AM, Irv Kalb 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. My answer from Stackoverflow [1]: > Properties are a special kind of attribute. Basically, when Python encoun

Re: Definition of "property"

2021-05-30 Thread Barry Scott
e 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

Re: Definition of "property"

2021-05-30 Thread Chris Angelico
t 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 > defini

Definition of "property"

2021-05-30 Thread Irv Kalb
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 prope