In python, you can simply access the attribute directly because it is publicly available:
class MyClass(object): def __init__(self): self.my_attribute = 0 my_object = MyClass() my_object.my_attribute = 1
If you want to do something to access or mutate an attribute, you can use the properties :
class MyClass(object): def __init__(self): self._my_attribute = 0 @property def my_attribute(self):
It is imperative that the client code remains the same.
blokeley Apr 05 '10 at 18:16 2010-04-05 18:16
source share