So ive got a class that looks like this:
class Item:
name: str = None # The name of the item
[...]
requiredIngredients: list = [] # A list of ingredients required to make/use this item
def __init__(self, name):
self.name = name
I then create an object of that class like this
stone = Item("Stone")
When i check stone.requiredIngredients its empty, as expected here. But then I add another object
pillar = Item("Pillar")
pillar.requiredItems.append(stone)
Now when i check stones required ingredients, id expect it to still be empty, as ive modified Pillar, not stone, but instead i find stone.requiredIngredients and pillar.requiredIngredients are identical
Am i doing something wrong here? How can i append an objects list without updating other objects?