2010-09-07 | Paul Boddie | raw annotate files changeset graph | Changed attribute usage tracking to consider branching and separate usage possibilities in a slightly more rigourous way. Attempted to add isinstance support. Added tests of the revised attribute usage support. |
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 class E: 15 def f(self): 16 return 4 17 18 def h(self): 19 return 5 20 21 def test_conditional(obj): 22 # obj: C, D, E (f) 23 if obj.f(): # C, D, E (f) 24 return obj.g() # D (f, g) 25 else: 26 return obj.h() # E (f, h) 27 # # (f, g) ^ (f, h) 28 29 c = C() 30 d = D() 31 e = E() 32 result1_3 = test_conditional(d) 33 34 # vim: tabstop=4 expandtab shiftwidth=4