Properties example
#Ilustration of atribute wrapping in # Python using set and get paradigm class Pizza: def __init__(self, tp): self.topp = tp self.cs=0 # set counter self.cg=0 # get counter @property def Topping(self): return @Topping.setter def Topping(self, tp): self.cs+=1 self.topp = tp @Topping.getter def Topping(self): self.cg+=1 return self.topp pizza = Pizza("tomato") print("Topping:"+pizza.Topping) pizza.Topping="potato" print("Topping:"+pizza.Topping) #While it looks like simple access to # Topping atribute there is underlying # functionality to count number of # times atribute was changed or read print("Times set:{0}".format(pizza.cs)) print("Times get:{0}".format(pizza.cg))