(self, excluded)
| 2 | |
| 3 | class Subject: |
| 4 | def __init__(self, excluded): |
| 5 | # excluded is a list of attribute names |
| 6 | |
| 7 | # who should be notified |
| 8 | self.__dict__['_observers'] = [] |
| 9 | |
| 10 | # which attrs should not trigger a notification |
| 11 | # obviously it can be done the other way round if needed |
| 12 | # i.e.which attrs trigger a notification |
| 13 | self.__dict__['_excluded_attrs'] = copy.copy(excluded) |
| 14 | |
| 15 | def __setattr__(self, attrname, value): |
| 16 | # set the attribute |