Skip to content Skip to sidebar Skip to footer

Can I Provide Python Class Method As A Parameter?

I would like to provide a method of a class as a parameter. Below is a simple example of what I'm after. Say I have some class defined like this: class TestClass(object): def

Solution 1:

print getattr(self.str1, arg1)(1)

Post a Comment for "Can I Provide Python Class Method As A Parameter?"