2012-06-04 | Paul Boddie | raw annotate files changeset graph | Simplify attribute assignment by insisting on the types identified from usage observations, only noting assignments on those and not on any type that could support a particular attribute. |
1 #!/usr/bin/env python 2 3 class C: 4 def f(self): 5 return 1 6 7 class D: 8 def f(self): 9 return 2 10 11 def g(self): 12 return 3 13 14 def test_loop(d): # d: f, g; g 15 for j in xrange(0, 10): 16 k = d.f() # d: f 17 # d: f, g (from else) 18 else: 19 k = d.g() # d: g 20 21 return k 22 23 c = C() 24 d = D() 25 26 result_3 = test_loop(d) 27 28 # vim: tabstop=4 expandtab shiftwidth=4