2016-11-21 | Paul Boddie | raw annotate files changeset graph | Added alias serialisation in order to preserve origin information for imported instances in the cached data. |
1 class C: 2 def __init__(self): 3 self.a = 1 4 5 b = 2 6 7 class D: 8 def __init__(self): 9 self.a = 3 10 self.b = 4 11 12 class E: 13 a = 5 14 b = 6 15 16 def f(x): 17 return x.a, x.b 18 19 def g(x): 20 21 # Should only permit D instance and E. 22 23 x.a = 7 24 x.b = 8 25 26 c = C() 27 d = D() 28 e = E() 29 30 result1 = f(c) # (1, 2) 31 result2 = f(d) # (3, 4) 32 result3 = f(e) # (5, 6)