我在 Python 和 Julia 中做了一个项目,并且在诸如(Julia 版本)之类的函数中有代码:
function foo(a,b)
c = a+b
#more code here
end
Run Code Online (Sandbox Code Playgroud)
或(Python 版本)
def foo(a,b):
c=a+b
#more code here
Run Code Online (Sandbox Code Playgroud)
然后我需要通过检查变量的值来测试这些函数(在函数范围内)。我想避免写print(variables)或return variables每次。有什么方法可以帮助我自动将所有变量传递到外部作用域,以便开发环境可以轻松检查它们?