Read Only attributes, auto properties and getters and setters
GDoermann at gmail.com
Thu Feb 12 16:58:32 CET 2009
Oh... one other thing that would be really cool is to do this with AOP/
descriptors! I just haven't been able to get that to work either.
def __init__(self, x):
def set_x(self, x):
print 'Hello the setter was called!'
self.__x = x
and it's done! I don't think this will work because (maybe I'm wrong)
but I don't think you can set the metaclass in the descriptor??? If
this is the case, it is more work to do the AOP and set a metaclass...
better to just inherit. If it can be done... that would be awesome!
More information about the Python-list