Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # data handler
- # logic
- class Location:
- def __init__(self, name, units):
- self.name = name
- self.units = units
- def update(self):
- # slome logic
- self.units.append("unit_after_update")
- # visualization handler
- class Screen:
- def __init__(self, name, location):
- self.name = name
- self.location = location
- def update(self):
- print("updating")
- self.location.update()
- def __repr__(self):
- return f"{self.name} units:{self.location.units}"
- loc = Location("location_1", ["unit_1",])
- scr = Screen("temp", loc)
- print(scr)
- scr.update()
- scr.update()
- print(scr)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement