I am working with a class and trying to call a helper method from a class. I got the following code to work, but I'm not sure why I need to pass the “I” as an argument to the helper function when I call it, when I already have the “I” as the argument in the method. Is there a reason why I should pass this as an argument when I call Frequency .__ helper (self, record) in the example below?
Thank!
class Frequency:
def __init__(self, record):
self.record = record
def __helper(self, datalist)
do something to datalist...
def getFreq(self):
allrec = self.record
record = allrec[1].split(' ')
var = Frequency.__helper(self, record)
return var
source
share