Dictionary surprise

1295 days ago by pub

var('a b c') d0 = {a:1,b:2,c:x} d1 = dict(a = 1,b = 2,c = x) (a.subs(d0) + b == c).subs(d0);(a.subs(d1) + b == c).subs(d1) 
       
3 == x
b + 1 == c
3 == x
b + 1 == c
d0;d1 
       
{a: 1, c: x, b: 2}
{'a': 1, 'c': x, 'b': 2}
{a: 1, c: x, b: 2}
{'a': 1, 'c': x, 'b': 2}