2013-01-14 | Paul Boddie | file changeset files shortlog | Moved common logic into a separate method. |
paul@514 | 1 | #!/usr/bin/env python |
paul@514 | 2 | |
paul@514 | 3 | class C: |
paul@514 | 4 | def method(self): |
paul@514 | 5 | return 123 |
paul@514 | 6 | |
paul@514 | 7 | class D: |
paul@514 | 8 | method = C.method # won't rebind to D |
paul@514 | 9 | |
paul@514 | 10 | c = C() |
paul@514 | 11 | d = D() |
paul@514 | 12 | result_123 = c.method() |
paul@514 | 13 | result2_123 = d.method(c) # need D instance to function |
paul@514 | 14 | |
paul@514 | 15 | # vim: tabstop=4 expandtab shiftwidth=4 |