I have
class Foo():
function bar():
pass
function foobar():
pass
Rather than executing each function one by one as
This works and preserves the order:
class F:
def f1(self, a):
return (a * 1)
def f2(self, a):
return (a * 2)
def f3(self, a):
return (a * 3)
allFuncs = [f1, f2, f3]
def main():
myF = F()
a = 10
for f in myF.allFuncs:
print('{0}--> {1}'.format(a, f(myF, a)))
The output would be:
10--> 10
10--> 20
10--> 30
Note: The advantage of using this instead of F.__dict__.values() is that here you can have a list of those functions that you prefer to be called, and not necessarily all of them.