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@2 | 1 | import operator |
paul@2 | 2 | |
paul@2 | 3 | def f(a, op, b): |
paul@2 | 4 | return op(a, b) |
paul@2 | 5 | |
paul@214 | 6 | print f(1, operator.add, 2) # 3 |
paul@214 | 7 | print f(1, operator.sub, 2) # -1 |