1 #!/usr/bin/env python 2 3 class B: 4 def f(self): 5 pass 6 7 def f(self): 8 pass 9 10 b = B() 11 12 # on A on a 13 class A: 14 f1 = f # unbound (A) bound (a) 15 f2 = B.f # unbound (B) unbound (B) 16 f3 = b.f # bound (b) bound (b) 17 18 def __init__(self): 19 self.f4 = f # N/A function 20 self.f5 = B.f # N/A unbound (B) 21 self.f6 = b.f # N/A bound (b) 22 23 def m(self): 24 x = self.f1 # should use optimised attribute access 25 x = self.f2 26 x = self.f3 27 x = self.f4 28 x = self.f5 29 x = self.f6 30 31 a = A() 32 a.m() 33 34 A.f1 35 A.f2 36 A.f3 37 a.f1 38 a.f2 39 a.f3 40 a.f4 41 a.f5 42 a.f6 43 44 # vim: tabstop=4 expandtab shiftwidth=4