I need to use __getitem__
for all 7 arguments in my class but __getitem__
won't let me so I tried to use a tuple
but I keep getting this error:
TypeError: cannot unpack non-iterable int object
What should I do?
def __getitem__(self, key):
name,author,category,Isbn_number,printing_house,date,number_of_order = key
return (self.name,self.author,self.category,self.Isbn_number,self.printing_house,self.date,self.number_of_order)
get
method, no need to pass in any arguments to the method nor even follow the python__getitem__
convention. – pangyuteng