How can I get the name of the current method in python?

April 30, 2018
python

I was looking for a generic way to extract the name of the current method (or function) in python. Here is one way to do it -

import sys
method_name = sys._getframe().f_code.co_name
print(method_name)

Purge all items from an AWS dynamodb table with an exponential timing back-off

May 21, 2018
aws dynamodb python

Copy an AWS dynamodb table to an existing table with an exponential timing back-off

May 20, 2018
aws dynamodb python

Return the key with the maximum value in a dictionary using python

May 14, 2018
python