2011-05-09 | Paul Boddie | raw annotate files changeset graph | Added tests of method assignment to classes plus notes about work to be done. |
1 #!/usr/bin/env python 2 3 class C: 4 def f(self): 5 return 1 6 7 class D: 8 def f(self): 9 return 2 10 11 def g(self): 12 return 3 13 14 class E: 15 def f(self): 16 return 4 17 18 def h(self): 19 return 5 20 21 def test_conditional(obj): 22 # obj: f, g; f, h 23 if obj.f(): 24 return obj.g() 25 else: 26 return obj.h() 27 28 c = C() 29 d = D() 30 e = E() 31 result1_3 = test_conditional(d) 32 33 # vim: tabstop=4 expandtab shiftwidth=4