Copies 'digits' but shares 'letters'.
(self)
| 12 | self.letters = ['x', 'y'] |
| 13 | |
| 14 | def custom_copy(self): |
| 15 | """ Copies 'digits' but shares 'letters'. """ |
| 16 | c = copy.copy(self) |
| 17 | c.digits = copy.copy(self.digits) |
| 18 | return c |
| 19 | |
| 20 | a = My_Class() |
| 21 | b = a.custom_copy() |