Re: Using properties
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: Using properties

From: alex23 <wuwei23@gmail.com>
Date: Thu May 26 2005 - 03:29:38 CEST

tkpmep@hotmail.com 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 were initially after by wrapping the
property's get/set around the objects '__dict__' attribute:

    def getname(self): return self.__dict__['name']
    def setname(self): self.__dict__['name'] =newname

Hope this helps.

-alex23
Received on Thu Sep 29 16:13:58 2005