I have a module with the class Foo
. Foo
has three methods:
- The constructor(
__init__()
) - An error handling method (
_error_handler()
) - The method that actually does something. (
run()
)
Then, I have a bunch of helper methods which are actually called by run()
. These methods, at the time of this writing, are declared as "private" methods, that is, _helper1
, _helper2
...
Now my question is, such methods that are not really part of the scope of the class, should be declared as "private" methods as I'm doing right now? Or just put them outside of the class?
class Foo:
def __init__(self)
def _error_handler(self, error_code)
def _helper1(self)
def _helper2(self)
def run(self):
self._helper1()
some stuff
self._helper2()
more stuff
Or by contrast, should my module looks like:
def _helper1()
def _helper2()
class Foo:
def __init__(self)
def _error_handler(self, error_code)
def run(self):
helper1()
some stuff
helper2()
more stuff