I am creating a Python class, that will include a method that ideally takes a list as an input. The method is supposed to take one of the member values, and determine a bin value, based on a sorted input list.
class sdata:
def __init__(self, score, sidx=-1):
self.score = score
self.sidx = sidx
def getsidx(sblist):
self.sidx = 0
for s in sblist:
if self.score < s:
return
self.sidx += 1
return
But when I try to run it, i.e...
a = sdata(0.33)
a.getsidx([0.50, 0.75])
...I get an error message of TypeError: getsidx() takes 1 positional argument but 2 were given
How do I tell Python to treat the input to a class method as a arbitrary-length list, and not try to use the first argument of the list as the sole input value?