You are modifying the mutable value, so you need to make an explicit copy:
bar = list(foo)
or
bar = foo[:]
When assigning a name in Python, all you do is keep a reference to the value. Without creating a copy of the list, both fooand barbelong to the same list.
; , , , .
( dict set ) . foo, foo. foo.append(9), Python :
Python , , . , , - . bar = foo , .
, .