Passing a function as an argument from within the same class?
debatem1 at gmail.com
Fri May 1 19:26:12 CEST 2009
> 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
print "running function 1"
def function2(self, passedFunction=doNothing):
print "running passed function"
again, though- bearophile's is the best, and most standard,
More information about the Python-list