2010-06-12 | Paul Boddie | file changeset files shortlog | Fixed scope handling where names are imported into namespaces. Added a simple iter built-in function. Made the xrange test use the iteration protocol. |
paul@279 | 1 | #!/usr/bin/env python |
paul@279 | 2 | |
paul@279 | 3 | class C: |
paul@279 | 4 | def f(self): # unused |
paul@279 | 5 | return 1 |
paul@279 | 6 | |
paul@279 | 7 | class D: |
paul@279 | 8 | def f(self): |
paul@279 | 9 | return 2 |
paul@279 | 10 | |
paul@279 | 11 | def g(self): |
paul@279 | 12 | return 3 |
paul@279 | 13 | |
paul@279 | 14 | class E: |
paul@279 | 15 | def f(self): # unused |
paul@279 | 16 | return 4 |
paul@279 | 17 | |
paul@279 | 18 | def h(self): # unused |
paul@279 | 19 | return 5 |
paul@279 | 20 | |
paul@279 | 21 | def test_one(obj): |
paul@279 | 22 | # obj: D (f, g) |
paul@279 | 23 | obj.f() # C, D, E (f) |
paul@279 | 24 | return obj.g() # D (f, g) |
paul@279 | 25 | |
paul@279 | 26 | c = C() |
paul@279 | 27 | d = D() |
paul@279 | 28 | e = E() |
paul@279 | 29 | result1_3 = test_one(d) |
paul@279 | 30 | |
paul@279 | 31 | # vim: tabstop=4 expandtab shiftwidth=4 |