2017-02-25 | Paul Boddie | file changeset files shortlog | Avoided using temporary accessor variables when names are used as accessors. Added a means of communicating the context of an access to the translator so that names can be used as contexts in certain cases instead of using temporary variables. |
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 |