Make doNothing a classmethod.

class SomeClass:

    @classmethod
    def doNothing(cls):
        pass

    def function1(self):
        print "Running function 1"

    def function2(self, passedFunction=SomeClass.doNothing):
        print "Running passed function"
        passedFunction()

someObject = SomeClass()
someObject.function2()
someObject.function2(someObject.function1)


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to