2011-02-26 | Paul Boddie | file changeset files shortlog | Added tag feature-universal-__class__-attributes for changeset 83dc777c7083 |
paul@288 | 1 | #!/usr/bin/env python |
paul@288 | 2 | |
paul@288 | 3 | class C: |
paul@288 | 4 | def f(self): |
paul@288 | 5 | return 1 |
paul@288 | 6 | |
paul@288 | 7 | class D: |
paul@288 | 8 | def f(self): |
paul@288 | 9 | return 2 |
paul@288 | 10 | |
paul@288 | 11 | def g(self): |
paul@288 | 12 | return 3 |
paul@288 | 13 | |
paul@288 | 14 | class E: |
paul@288 | 15 | def f(self): |
paul@288 | 16 | return 4 |
paul@288 | 17 | |
paul@288 | 18 | def h(self): |
paul@288 | 19 | return 5 |
paul@288 | 20 | |
paul@288 | 21 | def test_conditional(obj): |
paul@380 | 22 | # obj: f, g; f, h |
paul@380 | 23 | if obj.f(): |
paul@380 | 24 | return obj.g() |
paul@288 | 25 | else: |
paul@380 | 26 | return obj.h() |
paul@288 | 27 | |
paul@288 | 28 | c = C() |
paul@288 | 29 | d = D() |
paul@288 | 30 | e = E() |
paul@377 | 31 | result1_3 = test_conditional(d) |
paul@288 | 32 | |
paul@288 | 33 | # vim: tabstop=4 expandtab shiftwidth=4 |