2012-06-03 | Paul Boddie | raw annotate files changeset graph | Restricted attribute assignments observed through usage analysis to instance attributes only. |
1 #!/usr/bin/env python 2 3 class A: 4 def f(self, x): 5 return 0 6 def g(self, y): 7 return 2 8 9 class B: 10 def g(self, z): 11 return 4 12 13 def f(x, y): # x : A, B 14 result = x.g(1) 15 while y: # x : A only 16 y = x.f(1) 17 return result 18 19 a = A() 20 b = B() 21 result_2 = f(a, 1) 22 23 # vim: tabstop=4 expandtab shiftwidth=4