| 2863 | # Testing inheritance from basic types... |
| 2864 | |
| 2865 | class hexint(int): |
| 2866 | def __repr__(self): |
| 2867 | return hex(self) |
| 2868 | def __add__(self, other): |
| 2869 | return hexint(int.__add__(self, other)) |
| 2870 | # (Note that overriding __radd__ doesn't work, |
| 2871 | # because the int type gets first dibs.) |
| 2872 | self.assertEqual(repr(hexint(7) + 9), "0x10") |
| 2873 | self.assertEqual(repr(hexint(1000) + 7), "0x3ef") |
| 2874 | a = hexint(12345) |
no outgoing calls
searching dependent graphs…