2010-02-08 | Paul Boddie | raw annotate files changeset graph | Added control-flow branch abandonment for statements like break, continue, raise and return, preventing attribute usage from such branches from contributing to subsequent usage observations. Split the initial attribute usage test into smaller tests. Added notes about testing guard suitability. |
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: # unused 15 def f(self): 16 return 4 17 18 def h(self): 19 return 5 20 21 def test_neither(obj, obj2): 22 # obj: 23 # obj2: 24 if 0: 25 obj.g() # D (g) 26 else: 27 obj.f() # C, D, E (f) 28 # # (g) ^ (f) 29 return 4 30 31 c = C() 32 d = D() 33 result1_4 = test_neither(c, d) 34 35 # vim: tabstop=4 expandtab shiftwidth=4