Just for instance,
c = myClass()
Attribute
x
ofmyClass
is readonly. Trying to changec.x
raises an error.Attributes
a
andb
ofmyClass
are connected bya=2*b
. When one changes, the other changes automatically too.
c.a = 10
# or setattr(c,'a',10) or c.__setattr('a',10)
# c.b becomes 5
c.b = 10
# c.a becomes 20