Passing a function as an argument from within the same class?

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Fri May 1 10:44:43 EDT 2009


Zealalot, probably there are some ways to do that, but a simple one is
the following (not tested):

def function2(self, passed_function=None):
    if passed_function is None:
        passed_function = self.doNothing
    ...

Bye,
bearophile



More information about the Python-list mailing list