1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/tests/attributes_instance_bind_initialiser.py Sat May 30 20:30:28 2009 +0200
1.3 @@ -0,0 +1,23 @@
1.4 +#!/usr/bin/env python
1.5 +
1.6 +class B:
1.7 + def __init__(self, y):
1.8 + self.y = y
1.9 +
1.10 +class A:
1.11 + c1 = B
1.12 + def __init__(self, b):
1.13 + self.c2 = B
1.14 + self.c3 = b
1.15 +
1.16 +b = B(789)
1.17 +a = A(b)
1.18 +
1.19 +b1 = A.c1(678) # A.c1 is just a reference to B
1.20 +result_678 = b1.y
1.21 +b2 = a.c1(567) # a.c1 is just a reference to B
1.22 +result_567 = b2.y
1.23 +b3 = a.c2(765) # a.c2 is just a reference to B
1.24 +result_765 = b3.y
1.25 +
1.26 +# vim: tabstop=4 expandtab shiftwidth=4