iteration over methods

Paul Rubin phr-n2002b at NOSPAMnightsong.com
Tue Jan 7 12:32:11 CET 2003


Oliver Vecernik <vecernik at aon.at> writes:
>      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?

Try "for func in dir(self.__class__)".




More information about the Python-list mailing list