# On 07/11/2011 06:53 PM, Anthony Kong wrote: # But decorator! Of course! Thanks for reminding me this. # # In your example, where does '@not_here' come from? (Sorry, this syntax # is new to me)
class A(object): def __init__(self): self.not_here = 1 @property def not_here(self): return self.__not_here @not_here.setter def not_here(self, val): self.__not_here = val """ Let's translate that to non-decorator Python: """ class A(object): def __init__(self): self.not_here = 1 def _(self): return self.__not_here not_here = property(_) del _ def _(self, val): self.__not_here = val not_here = not_here.setter(_) del _ """ @not_here.setter exists because not_here.setter exists. not_here exists since we set it (when the getter/property was set). Cheers Thomas PS: are you sure the lambda self: self.__foo() trick works, with subclasses or otherwise? I haven't tested it, and I'm not saying it doesn't, but I have a feeling double-underscore name mangling might be a problem somewhere down the line? """ -- http://mail.python.org/mailman/listinfo/python-list