iteration over methods
Oliver Vecernik
vecernik at aon.at
Tue Jan 7 06:19:15 EST 2003
Hi!
I've got an object with some methods:
class Someclass(self):
def __init__(self):
pass
def method1(self):
pass
def method2(self):
pass
...
def runallmethods(self):
for func in dir(self):
if func[0:4] == 'method':
apply(self.func) # Does *not* work!
I'd like to run all methods named 'method...' in a sequence. Has anybody
a clue how to achive this?
Best Regards,
Oliver
More information about the Python-list
mailing list