I try to test my program to create a copy of an object and I get this error:
TypeError: __init__() takes 1 positional argument but 2 were given
I tried to check existing questions but I can't correct this error. Any suggestions?
This is my class:
class ordred_dict:
#"""
#This class is an ordred dictionary
#composed of 2 listes: key list and value list as a dictionary
#"""
def __init__(self, orig):
#"""
#Constructur to initiate an empty key and value list
#"""
self.key_list=list(orig.key_list)
self.value_list=list(orig.value_list)
def __init__(self, **Tuplekeysvalues):
#"""
#Create a new dict using a liste of (keys:values)
#"""
self.key_list=list()
self.value_list=list()
for key in Tuplekeysvalues:
self.key_list.append(key)
self.value_list.append(Tuplekeysvalues[key])
#print("({}:{}) ".format(key, Tuplekeysvalues[key]))
#Main program
dict3=ordred_dict(p1="1",p2="2",p4="4",p3="3",p0="0")
dict2=ordred_dict(dict3)