How would I copy all the properties of a class to a new instance of the class. In the example below, with the way python works, when I use b=a, it assigns b and a to the same memory address. When i make a change to "b" the change is also made to "a." Both elements of the list are stored at the same address
class test:
def __init__(self, name="Name",data=[]):
self.name=name
self.data=data
list=[]
a = test("First Name",["DATA1","DATA2","DATA3"])
b=a
list.append(a)
list.append(b)
I'm wanting to achieve something similar to how the list class allows you to do this to copy the list to a new memory address.
list1=[1,2,3]
list2=list(list1)
So in my case.
a = test("First Name",["DATA1","DATA2","DATA3"])
b=test(a)
without having to
b=test(a.name,a.data)
EDIT
Id like to achive the same effect as
b=copy.deepcopy(a)
but through this usage.
b=test(a)