I came across the following problem in Python:
I have a class called BasebookDataContainer
which is mainly a collection of Dicts.
Within a method of that class, I call a new instance of BasebookDataContainer
like this:
class BasebookDataContainer:
def generate_sub_basebook(self, columnlist):
....
newinstance = BasebookDataContainer()
A lot of strange things happen:
newinstance
automatically is loaded with all the data of the "self" instance of the classBasebookDataContainer
- When I change the data of
newinstance
, it also changes the data of the "self" instance
Is this normal and is there a way to avoid it?
Thanks for your answers.