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

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

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

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

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

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

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

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

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
. That's not a definition of a property -- it's talking about a mechanism that provides one way of creating a property, using decorators. DON'T quote that as a definition! -- Greg -- https://mail.python.org/mailman/listinfo/python-list

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

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

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

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, that's o

Re: Definition of "property"

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

Re: Definition of "property"

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

Re: Definition of "property"

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

Re: Definition of "property"

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

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 articles on line

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

Re: Definition of "property"

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

Re: Definition of "property"

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

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