python:将变量名作为参数传递给函数

时间:2017-11-06 16:12:31

标签: python namespaces parameter-passing

我想检索作为参数传递给函数的变量名。

以下是我要寻找的结果示例:

def my_func(a, b):   
    return a + b

>>> foo, bar = 1, 2
>>> get_arg_var_names(my_func(foo, bar))
foo
bar

请注意,我不会检索ab

0 个答案:

没有答案