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
[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
<[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
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
[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)
>
>
[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
<[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):
>
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"):