> Careful, bearophiles' answer remains the best one.
>
> The only reason your example worked is that you had already had
> SomeClass defined (probably from a previous experiment).

Scott is correct, and if bearophile and I ever give you conflicting
advice, take bearophile's.

A (corrected) bit of code that might serve your purpose would be
as follows:

class SomeClass:

    def doNothing():
        pass

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

    def function2(self, passedFunction=doNothing):
        print "running passed function"
        passedFunction()

again, though- bearophile's is the best, and most standard,
answer here
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to