class C(object):
def f(self):
return 1
def g(self):
return self.f() * 2
class a1(Aspect):
def f(self):
return 10
c = C()
self.assertEqual(a1(C)().f(), 10)
self.assertEqual(a1(c).f(), 10)
# BUT:
self.assertEqual(a1(C)().g(), 20)
self.assertEqual(a1(c).g(), 2)
g in the last line is bound to c, not a1(c), and therefore c.f is called instead of a1.f.