Gathering variable names from within a function.

Xavier sabu at pure-elite.org
Fri Jul 4 06:55:36 EDT 2003


Greetings,

I was wondering if there was a way to get a list of all the variables which
were executed/created/modified within a function?

Here is a simple example that comes to my mind:

def getVars(func):
    ...
    ...
    ...

def modVar(arg, arg2):

    Var1 = arg
    Var2 = arg2
    Var3 = arg+arg2
    return Var3

def main():

    print getVars(modVar('test', 'test2'))

# end

naturally, "Var1", "Var2" and "Var3" should be printed to the user.  Any
idea?

-- Xavier

oderint dum metuant







More information about the Python-list mailing list