I have the following class:
class Foo(object):
def setUp(self):
self.var1 = "some value"
self.var2 = something
def bar(self):
var3 = some value
def baz(self, var):
var4 = some value
I want to print the names of all variables defined inside the methods, like:
setUp, bar, baz, var1, var2, var3, var4
I have tried using locals(), vars(), globals()
but I am getting only the names of method and not variable names.
I also tried using ast
module, but no success.