| 74 | |
| 75 | |
| 76 | class Point(MutableComposite): |
| 77 | def __init__(self, x, y): |
| 78 | self.x = x |
| 79 | self.y = y |
| 80 | |
| 81 | def __setattr__(self, key, value): |
| 82 | object.__setattr__(self, key, value) |
| 83 | self.changed() |
| 84 | |
| 85 | def __composite_values__(self): |
| 86 | return self.x, self.y |
| 87 | |
| 88 | def __getstate__(self): |
| 89 | return self.x, self.y |
| 90 | |
| 91 | def __setstate__(self, state): |
| 92 | self.x, self.y = state |
| 93 | |
| 94 | def __eq__(self, other): |
| 95 | return ( |
| 96 | isinstance(other, Point) |
| 97 | and other.x == self.x |
| 98 | and other.y == self.y |
| 99 | ) |
| 100 | |
| 101 | |
| 102 | class MyPoint(Point): |
no outgoing calls