2013-10-31 | Paul Boddie | file changeset files shortlog | Added remarks about local namespaces and name usage observations. | syspython-as-target |
paul@377 | 1 | #!/usr/bin/env python |
paul@377 | 2 | |
paul@377 | 3 | class C: |
paul@377 | 4 | def f(self): |
paul@377 | 5 | return 0 |
paul@377 | 6 | |
paul@377 | 7 | class D: |
paul@377 | 8 | def f(self): |
paul@377 | 9 | return 2 |
paul@377 | 10 | |
paul@377 | 11 | def g(self): |
paul@377 | 12 | return 3 |
paul@377 | 13 | |
paul@377 | 14 | def test_conditional(obj): |
paul@380 | 15 | # obj: f, g; f |
paul@380 | 16 | if obj.f(): |
paul@380 | 17 | return obj.g() |
paul@377 | 18 | else: |
paul@380 | 19 | return obj.f() |
paul@377 | 20 | |
paul@377 | 21 | c = C() |
paul@377 | 22 | d = D() |
paul@377 | 23 | result1_0 = test_conditional(c) |
paul@377 | 24 | |
paul@377 | 25 | # vim: tabstop=4 expandtab shiftwidth=4 |