class item: readOnly = ['id'] def __init__(self, title, created, priority): self.id = -1 self.title = title self.created = created self.priority = priority def setId(self, id): if self.id == -1: self.id = id def getTitle(self): return self.title def getCreatedAt(self): return self.created def getPriority(self): return self.priority def __setattr__(self, name, value): if name not in item.readOnly: if name not in self.__dict__ or self.__dict__[name] != value: self.__dict__[name] = value if 'observer' in self.__dict__: self.observer.notifyChange(self)