2010-06-16 | Paul Boddie | raw annotate files changeset graph | Attempted to introduce a more conservative approach to visiting program units and collecting attributes. Moved the declaration of StopIteration into the inspection method for the "for" statement. Added module registration so that attribute collection successfully visits imported modules. |
1 #!/usr/bin/env python 2 3 class B: 4 def __init__(self, y): 5 self.y = y 6 7 class A: 8 c1 = B 9 def __init__(self, b): 10 self.c2 = B 11 12 b = B(789) 13 a = A(b) 14 15 b1 = A.c1(678) # A.c1 is just a reference to B 16 result_678 = b1.y 17 b2 = a.c1(567) # a.c1 is just a reference to B 18 result_567 = b2.y 19 b3 = a.c2(765) # a.c2 is just a reference to B 20 result_765 = b3.y 21 22 # vim: tabstop=4 expandtab shiftwidth=4