Suppose I have a class attribute in the form of list, and two functions inside that class that append data onto the list for further operations on the list.
Would this be a proper way to write the same:
class Sample:
def __init__(self):
self.Mylist = []
self.customfunc1()
self.customfunc2()
self.customfunc3()
def customfunc1(self):
somevar = 1
self.Mylist.append(somevar)
def customfunc2(self):
somevar = 2
self.Mylist.append(somevar)
def customFunc3(self):
## Operations on self.Mylist
Or Do I need to return a value after every sub function. I'm new to using 'self' reference so any help appreciated.
setfunctions usually don't return the modified member