2018-07-12 | Paul Boddie | file changeset files shortlog | Attempt to reintroduce function acquisition optimisations by extending context tests related to invocations of access results. |
paul@816 | 1 | class MixIn: |
paul@816 | 2 | def f(self): |
paul@816 | 3 | return self.g() |
paul@816 | 4 | def f2(self): |
paul@816 | 5 | return self.g2() |
paul@816 | 6 | |
paul@816 | 7 | class Concrete(MixIn): |
paul@816 | 8 | def g(self): |
paul@816 | 9 | return 13579 |
paul@816 | 10 | def g2(self): |
paul@816 | 11 | return 13579 |
paul@816 | 12 | |
paul@816 | 13 | class Cement(MixIn): |
paul@816 | 14 | def g2(self): |
paul@816 | 15 | return 24680 |
paul@816 | 16 | |
paul@816 | 17 | m = MixIn() |
paul@816 | 18 | |
paul@816 | 19 | try: |
paul@816 | 20 | print m.f() |
paul@816 | 21 | except TypeError: |
paul@816 | 22 | print "m.f: cannot obtain attribute" |
paul@816 | 23 | |
paul@816 | 24 | c = Concrete() |
paul@816 | 25 | print c.f() # 13579 |
paul@816 | 26 | |
paul@816 | 27 | try: |
paul@816 | 28 | print m.f2() |
paul@816 | 29 | except TypeError: |
paul@816 | 30 | print "m.f2: cannot obtain attribute" |
paul@816 | 31 | |
paul@816 | 32 | c2 = Cement() |
paul@816 | 33 | print c2.f2() # 24680 |