2017-03-20 | Paul Boddie | file changeset files shortlog | Handle functions in the always_callable method. |
paul@601 | 1 | class C: |
paul@601 | 2 | def f(self): |
paul@601 | 3 | print self |
paul@601 | 4 | return self.value() |
paul@601 | 5 | |
paul@601 | 6 | def value(self): |
paul@601 | 7 | return 123 |
paul@601 | 8 | |
paul@601 | 9 | c = C() |
paul@601 | 10 | |
paul@601 | 11 | class D: |
paul@601 | 12 | f = c.f |
paul@601 | 13 | |
paul@601 | 14 | d = D() |
paul@601 | 15 | |
paul@601 | 16 | print c.f.__name__ # f |
paul@601 | 17 | print c.f() # <__main__.C instance> |
paul@601 | 18 | # 123 |
paul@601 | 19 | print d.f.__name__ # wrapper |
paul@601 | 20 | print d.f() # <__main__.C instance> |
paul@601 | 21 | # 123 |