So, I realized that you have a long function like:
def long_func(blah, foo, *args): ... ... my_val = long_func(foo, blah, a, b, c)
What have you done:
def long_func(blah, foo, *args): def short_func1(): ... def short_func2(): ... ... short_func1() short_func2() ... ... my_val = long_func(foo, blah, a, b, c)
You have many more options, I will list two:
Do it in class
class SomeName(object): def __init__(self, blah, foo, *args): self.blah = blah self.foo = foo self.args = args self.result = None
Make another module and put short_funcs in it. Just as flyx suggested.
def long_func(foo, blah, *args): from my_module import short_func1, short_func2 short_func1(foo) short_func2(blah)
source share