Is it possible to write a function f
that takes an arbitrary tuple of mixed data:
T = 1.0
N = 20
L = 10
args = (T,N,L)
f(*args) # or maybe f(T,N,L)?
and returns as output:
{'T':1.0, 'N':20, 'L':10}
There is a related question using local
, but I seem to lose the names once they are passed to the function. Is there a way to prevent this? I'm guessing that the variables are being passed by value and thus they are considered new objects.
Followup: Python: Using a dummy class to pass variable names?