I'm trying to pass variable list in Class and Function in object oriented manner but facing some error, I don't understand what wrong with it and I'm using PyDev in Eclipse
CODE
class Mydetails:
__details = ''
def __init__(self,details): # constructor
#self.__details['country'] = details['country']
self.__details = details
def set_element(self,details):
self.__details = details
def get_list(self,details):
return self.__details
details = ['ABC','DEF','GHI','JKL']
pdetails = Mydetails()
pdetails.set_element(details)
print(pdetails.get_list())
OUTPUT
Traceback (most recent call last):
File "C:\workspace\python\pythonapp\list.py", line 18, in <module>
pdetails = Mydetails()
TypeError: __init__() missing 1 required positional argument: 'details'