tests/methods_bound.py | raw changeset files shortlog |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tests/methods_bound.py Sat Oct 08 00:43:13 2016 +0200 1.3 @@ -0,0 +1,14 @@ 1.4 +class C: 1.5 + def m(self, x): 1.6 + return x 1.7 + 1.8 +def f(obj, i): 1.9 + if i: 1.10 + return obj.m(i) 1.11 + else: 1.12 + return obj.m 1.13 + 1.14 +c = C() 1.15 +result1 = f(c, 1) 1.16 +fn = f(c, 0) 1.17 +result2 = fn(2)