Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Animal:
- def __init__(self, **kwargs):
- self.properties = kwargs
- @property
- def color(self):
- print('DEBUG: color getter')
- return self.properties
- @color.setter
- def color(self, value):
- print('DEBUG: color setter')
- self.properties['color'] = value
- dog = Animal()
- print("DEBUG: dog.color['new_dog'] = 'Brown'")
- dog.color['new_dog'] = 'Brown'
- print("DEBUG: dog.color = 'Red'")
- dog.color = 'Red'
- print("DEBUG: print(dog.color)")
- print(dog.color)
- cat = Animal()
- print("DEBUG: cat.color = 'white'")
- cat.color = 'white'
- print("DEBUG: print(cat.color)")
- print(cat.color)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement