2011-02-26 | Paul Boddie | file changeset files shortlog | Added tag feature-universal-__class__-attributes for changeset 83dc777c7083 |
paul@385 | 1 | #!/usr/bin/env python |
paul@385 | 2 | |
paul@385 | 3 | class C: |
paul@385 | 4 | def f(self): |
paul@385 | 5 | return 1 |
paul@385 | 6 | |
paul@385 | 7 | class D: |
paul@385 | 8 | def f(self): |
paul@385 | 9 | return 2 |
paul@385 | 10 | |
paul@385 | 11 | def g(self): |
paul@385 | 12 | return 3 |
paul@385 | 13 | |
paul@385 | 14 | def test_loop(d): # d: f, g; g |
paul@385 | 15 | for j in xrange(0, 10): |
paul@385 | 16 | k = d.f() # d: f |
paul@385 | 17 | # d: f, g (from else) |
paul@385 | 18 | else: |
paul@385 | 19 | k = d.g() # d: g |
paul@385 | 20 | |
paul@385 | 21 | return k |
paul@385 | 22 | |
paul@385 | 23 | c = C() |
paul@385 | 24 | d = D() |
paul@385 | 25 | |
paul@385 | 26 | result_3 = test_loop(d) |
paul@385 | 27 | |
paul@385 | 28 | # vim: tabstop=4 expandtab shiftwidth=4 |