I have many functions like:
def DBworker_thatdoes_job7():
print "DBworker_thatdoes_job7 starting..."
... the actual code here ...
print "DBworker_thatdoes_job7 finished."
How to do this without hardcoding the function names? Here is what I want to achieve:
def DBworker_thatdoes_job7():
print thisfunction.name + " starting..."
...
def DBworker_thatdoes_cleaning18():
print thisfunction.name + " starting..."
...
Note: I've already looked at How to get a function name as a string in Python? but I don't really see a nice way to do it here. Also, this question is close to Determine function name from within that function (without using traceback) but here applied to the specific use case of function-name logging at startup and end, thus not exactly a duplicate.