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@815 | 1 | f = lambda x: (x, 1) |
paul@815 | 2 | |
paul@815 | 3 | class C: |
paul@815 | 4 | f = lambda x: (x, 2) |
paul@815 | 5 | |
paul@815 | 6 | print f(123) # (123, 1) |
paul@815 | 7 | |
paul@815 | 8 | c = C() |
paul@815 | 9 | print c.f # __main__.C.$l0 |
paul@815 | 10 | print c.f(123) # (123, 2) |
paul@815 | 11 | |
paul@815 | 12 | c.f = f |
paul@815 | 13 | print c.f(123) # (123, 1) |
paul@815 | 14 | |
paul@815 | 15 | C.f = f |
paul@815 | 16 | c2 = C() |
paul@815 | 17 | print c2.f(123) # (123, 1) |