Using Python I want to create a property in a class, but having the name of it in a string. Normally you do:
blah = property(get_blah, set_blah, del_blah, "bleh blih")
where get_, set_ and del_blah have been defined accordingly. I've tried to do the same with the name of the property in a variable, like this:
setattr(self, "blah", property(self.get_blah, self.set_blah, self.del_blah, "bleh blih"))
But that doesn't work. The first case blah returns the value of the property, on the second case, it returns a property, that is <property object at 0xbb1aa0>
. How should I define it so it works?