2021-06-29 | Paul Boddie | file changeset files shortlog | Renamed the utf8string class to unicode, eliminating the unicode function. This means that the simple case of merely returning an object if it is already a Unicode object no longer occurs when using the unicode callable, but such behaviour might be better supported with more general customised instantiation functionality. |
paul@351 | 1 | class C: |
paul@351 | 2 | def __init__(self): |
paul@351 | 3 | self.x = 1 |
paul@351 | 4 | def f(self): |
paul@351 | 5 | return self.x |
paul@351 | 6 | |
paul@351 | 7 | class D(C): |
paul@351 | 8 | pass |
paul@351 | 9 | |
paul@351 | 10 | class E(C): |
paul@351 | 11 | def __init__(self, x): |
paul@351 | 12 | self.x = x |
paul@351 | 13 | |
paul@351 | 14 | d = D() |
paul@351 | 15 | print d.f() |
paul@351 | 16 | |
paul@351 | 17 | e = E(2) |
paul@351 | 18 | print e.f() |