I like to know what was the local variable names when they are passed to a function. I’m not sure whether this is possible at all. Let’s consider this example:
function definition:
def show(x):
print(x)
usage:
a = 10
show(a)
this prints 10. But I like to print “a = 10”. Is this possible in python?
No, you cannot know what the name was of the local variable used to pass a value to your function.
This is an impossible task in any case. What would be the variable name in the following example?
Here we pass in 3 arguments, two taken from a tuple we defined earlier, and one literal value, and all three are passed in using the variable argument list syntax.