2009-04-23 | Paul Boddie | file changeset files shortlog | Added missing built-in methods. Added inspection of "if" test expressions. Removed StoreName from the constant storage optimisation (until population of locals/frames is implemented). Added debugging attributes to RSVPMachine for the object and parameter lists. Fixed the StoreName instruction to use the source, not the value. Added common names in use. |
paul@121 | 1 | #!/usr/bin/env python |
paul@121 | 2 | |
paul@121 | 3 | def e(x): pass |
paul@121 | 4 | |
paul@121 | 5 | class C: |
paul@121 | 6 | e = e |
paul@121 | 7 | |
paul@123 | 8 | def test(self): |
paul@123 | 9 | self.e() |
paul@123 | 10 | |
paul@121 | 11 | class D: |
paul@121 | 12 | e = C.e |
paul@121 | 13 | |
paul@123 | 14 | def test(self): |
paul@157 | 15 | self.e(1) # TypeError: unbound C.e needs C instance, not int |
paul@123 | 16 | |
paul@121 | 17 | class E(C): |
paul@186 | 18 | # e = C.e (via inheritance) |
paul@186 | 19 | |
paul@123 | 20 | def test(self): |
paul@123 | 21 | self.e() |
paul@121 | 22 | |
paul@121 | 23 | c = C() |
paul@121 | 24 | d = D() |
paul@121 | 25 | e = E() |
paul@121 | 26 | |
paul@121 | 27 | p = c.e # bound C.e |
paul@121 | 28 | q = d.e # unbound C.e |
paul@121 | 29 | r = e.e # bound E.e |
paul@121 | 30 | |
paul@121 | 31 | # vim: tabstop=4 expandtab shiftwidth=4 |