2013-07-01 | Paul Boddie | file changeset files shortlog | Introduced numbered functions where rebinding occurs in namespaces. Added an original name attribute to classes and functions, revised the check for usage of functions when generating code or reports, and added rebinding statements to module "main program" syspython output. Fixed the attribute operation generated by syspython when acquiring module attributes for a "from" statement. | syspython-as-target |
paul@87 | 1 | #!/usr/bin/env python |
paul@87 | 2 | |
paul@87 | 3 | class B: |
paul@87 | 4 | def f(self): |
paul@186 | 5 | print self |
paul@87 | 6 | |
paul@186 | 7 | def f(self): |
paul@186 | 8 | print self |
paul@87 | 9 | |
paul@187 | 10 | class A: |
paul@187 | 11 | f0 = f |
paul@187 | 12 | |
paul@87 | 13 | b = B() |
paul@87 | 14 | |
paul@186 | 15 | # on A on a context on A attribute context on a attribute |
paul@187 | 16 | A.f0 # unbound bound (a) A (need A instance) a |
paul@187 | 17 | A.f1 = f # unbound bound (a) A (need A instance) a |
paul@186 | 18 | A.f2 = B.f # unbound unbound B (need B instance) B (need B instance) |
paul@186 | 19 | A.f3 = b.f # bound (b) bound (b) b b |
paul@87 | 20 | a = A() |
paul@186 | 21 | a.f4 = f # N/A function N/A none |
paul@186 | 22 | a.f5 = B.f # N/A unbound N/A B (need B instance) |
paul@186 | 23 | a.f6 = b.f # N/A bound (b) N/A b |
paul@87 | 24 | |
paul@87 | 25 | # vim: tabstop=4 expandtab shiftwidth=4 |