I’m having trouble understanding what seems to be a basic OOP concept. Using the simple code below, I don’t understand why the append statement in one init method affects both class objects, while the addition to the test variable is class/object-specific. Why does the self.mylist.append(4) statement also add a 4 to the self.mylist in the other object?
mylist = [1,2,3]
test = 10
class first:
  def __init__(self, mylist, test):
    self.mylist = mylist
    self.test = test
    self.test+=100
    
class second:
  def __init__(self, mylist, test):
    self.mylist = mylist
    self.mylist.append(4)
    self.test = test
    self.test+=500
    
one = first(mylist, test)
two = second(mylist, test)
print(one.mylist)
print(two.mylist)
print(one.test)
print(two.test)
I expect the lists to be specific to the objects so that it would print 1,2,3 and 1,2,3,4 but both are 1,2,3,4.
 
    