As @mato mentioned, source
and s1
are only references, so when you say source = s1
you update the source
reference, but the branch still points to the old value of source
. When you use s1.Copy(source)
, you copy the values from s1
into the object referred to by source
, which is what you want. Have a look at the link below, towards the end there is some interesting exploration of Python objects.