tests/methods_unbound.py | raw changeset files shortlog |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/tests/methods_unbound.py Thu Nov 24 00:58:36 2016 +0100 1.3 @@ -0,0 +1,15 @@ 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 +#print f(C, 1) # NOTE: Need to raise and handle error. 1.16 +fn = f(C, 0) 1.17 +print get_using(fn, c)(2) # 2 1.18 +print get_using(f(C, 0), c)(2) # 2