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