Say I got a simple class with one public and one private method. If I call the private method in the public method - should it return a value, or should that value be set as a field in my object, for example,
class Test:
def __init__(self, path):
self.path = path
def __getNoOfFiles(self):
'count files in self.path'
return no_of_files
def readDir(self)
...
no_of_files = __getNoOfFiles()
or
class Test:
def __init__(self, path):
self.path = path
self.no_of_files = 0
def __getNoOfFiles(self):
self.no_of_files = 'count files in self.path'
def readDir(self)
__getNoOfFiles()
no_of_files = self.no_of_files