In the example below, when calling the .add() method on the set B, set A is also affected:
A = {0,1,3,4,5}
B = A
B.add(10)
I expect this because A and B are both pointing to the same set object.
However, in this slightly different situation, set A is unaffected:
A = {0,1,3,4,5}
B = A
B = B - {0,1}
In this second example, why is a new object created for B to point to? What explains this difference in behaviour?