Hybrid meeting ANN: Using properties and descriptors

2023-07-11 Thread dn via Python-list
This month's meeting (Wed 19 July, 1800 for 1830 NZST = 0600/0630 UTC) will cover more-advanced OOP Python skills. You will be most-welcome to join us... "Using properties and descriptors" will look at a series of code-examples exploring problems and how these constructs o

Re: Using properties

2005-05-25 Thread alex23
[EMAIL PROTECTED] wrote: > Thanks for the help. I now understand it better. As Bruno points out, I > really don't need a property in this case, as my attribute is public, > and I will remove it. Should you need it to be a property at a latter date, it's worth noting that you can achieve what you w

Re: Using properties

2005-05-25 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thanks for the help. I now understand it better. As Bruno points out, I > really don't need a property in this case, as my attribute is public, > and I will remove it. As much to the point is that your name attribute is static in the

Re: Using properties

2005-05-25 Thread tkpmep
Thanks for the help. I now understand it better. As Bruno points out, I really don't need a property in this case, as my attribute is public, and I will remove it. Thomas Philips -- http://mail.python.org/mailman/listinfo/python-list

Re: Using properties

2005-05-25 Thread bruno modulix
[EMAIL PROTECTED] wrote: > I have a class with a name attribute, which I want to modify using > property.The following code works just fine: > > class Portfolio(object): > > def __init__( self, name="Port1"): > self.name=name This may not do what you think it does (see below) > >

Re: Using properties

2005-05-25 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > name=property(getname,setname,None,None) > > However, it no longer works if I modify getname and setname to > > def getname(self): > return self.name > > def setname(self,newname="Port2"): > self.name=newname That's because you're actually

Re: Using properties

2005-05-25 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I have a class with a name attribute, which I want to modify using > property.The following code works just fine: > > class Portfolio(object): > >def __init__( self, name="Port1"): >self.name=name > >def getname(self): >

Using properties

2005-05-25 Thread tkpmep
I have a class with a name attribute, which I want to modify using property.The following code works just fine: class Portfolio(object): def __init__( self, name="Port1"): self.name=name def getname(self): return self._name def setname(self,newname="Port2"):