2013-10-31 | Paul Boddie | file changeset files shortlog | Added remarks about local namespaces and name usage observations. | syspython-as-target |
paul@531 | 1 | #!/usr/bin/env python |
paul@531 | 2 | |
paul@531 | 3 | class C: |
paul@531 | 4 | def f(self): |
paul@531 | 5 | return 1 |
paul@531 | 6 | def g(self): |
paul@531 | 7 | return 2 |
paul@531 | 8 | |
paul@531 | 9 | class D: |
paul@531 | 10 | def f(self): |
paul@531 | 11 | return 0 |
paul@531 | 12 | |
paul@531 | 13 | def test(x): |
paul@531 | 14 | if x.f() and x.g(): |
paul@531 | 15 | return 3 |
paul@531 | 16 | else: |
paul@531 | 17 | return 4 |
paul@531 | 18 | |
paul@531 | 19 | def test2(x): |
paul@531 | 20 | if not x.f() or x.g(): |
paul@531 | 21 | return 5 |
paul@531 | 22 | else: |
paul@531 | 23 | return 6 |
paul@531 | 24 | |
paul@531 | 25 | c = C() |
paul@531 | 26 | d = D() |
paul@531 | 27 | result_4 = test(d) |
paul@531 | 28 | result_5 = test2(d) |
paul@531 | 29 | |
paul@531 | 30 | # vim: tabstop=4 expandtab shiftwidth=4 |