2012-06-05 | Paul Boddie | raw annotate files changeset graph | Introduced more rigid selection of suitable types depending on whether all attributes given as being used can be found in one or more types, or whether the selection of less satisfactory types (supporting any of the attributes) is necessary. |
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