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 __init__(self, x): 5 self.x = x 6 self.z = None 7 8 def f(self, a): 9 if self.z: 10 pass 11 self.x = a 12 13 class D: 14 def __init__(self, y): 15 self.y = y 16 self.z = None 17 18 def g(self, a): 19 if self.z: 20 self.x 21 self.z = a 22 23 c = C(1) 24 d = D(2) 25 c.f(3) 26 d.g(4) 27 result_3 = c.x 28 result_4 = d.z 29 30 # vim: tabstop=4 expandtab shiftwidth=4