2012-06-09 | Paul Boddie | file changeset files shortlog | Introduced attribute usage branching for logical operators along with a test. |
paul@528 | 1 | #!/usr/bin/env python |
paul@528 | 2 | |
paul@528 | 3 | class C: |
paul@528 | 4 | def f(self): |
paul@528 | 5 | return 1 |
paul@528 | 6 | def g(self): |
paul@528 | 7 | return 2 |
paul@528 | 8 | |
paul@528 | 9 | class D: |
paul@528 | 10 | def g(self): |
paul@528 | 11 | return 3 |
paul@528 | 12 | |
paul@528 | 13 | def test_conditional(x, obj): |
paul@528 | 14 | obj.f() |
paul@528 | 15 | if x: |
paul@528 | 16 | if x: |
paul@528 | 17 | a = obj.g() |
paul@528 | 18 | return a |
paul@528 | 19 | return 1 |
paul@528 | 20 | |
paul@528 | 21 | c = C() |
paul@528 | 22 | d = D() |
paul@528 | 23 | result1_2 = test_conditional(1, c) |
paul@528 | 24 | |
paul@528 | 25 | # vim: tabstop=4 expandtab shiftwidth=4 |