I have
class Foo():
function bar():
pass
function foobar():
pass
Rather than executing each function one by one as
Since Python stores the methods (and other attributes) of a class in a dictionary, which is fundamentally unordered, this is impossible.
If you don't care about order, use the class's __dict__:
x = Foo()
results = []
for name, method in Foo.__dict__.iteritems():
if callable(method):
results.append(method(x))
This also works if the function takes extra parameters - just put them after the instance of the class.