The important thing to realize is, after the line a = b, you don't have two objects anymore. You have two variables, both referring to the same object. So when you change that object's color, both variables reflect it. the line b = a actually doesn't do anything.