2012-05-02 | Paul Boddie | file changeset files shortlog | Changed the visitor dispatch to occur through visit methods on the AST nodes. (This requires a modified version of the compiler package.) Added report output support for yield statements and conditional expressions. |
paul@226 | 1 | #!/usr/bin/env python |
paul@226 | 2 | |
paul@339 | 3 | def f(self, x): |
paul@226 | 4 | return x |
paul@226 | 5 | |
paul@226 | 6 | class C: |
paul@339 | 7 | e = f |
paul@226 | 8 | |
paul@226 | 9 | class E(C): |
paul@226 | 10 | # e = C.e (via inheritance) |
paul@226 | 11 | |
paul@226 | 12 | def f(self): |
paul@226 | 13 | return self.e |
paul@226 | 14 | |
paul@226 | 15 | e = E() |
paul@226 | 16 | r = e.f() # bound E.e |
paul@228 | 17 | result_321 = r(321) |
paul@226 | 18 | |
paul@226 | 19 | # vim: tabstop=4 expandtab shiftwidth=4 |