2011-07-02 | Paul Boddie | raw annotate files changeset graph | Moved some code generation methods into a new Assembler class. Separated sequence element storage into a separate method which may form the basis of a native library routine. |
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