Find out the name of a variable passed as an argument

John Henry john106henry at hotmail.com
Wed Oct 4 15:53:32 EDT 2006


Algol, anyone?


Andreas Huesgen wrote:
> Hello everybody,
>
> is there a way to receive the name of an object passed to a function
> from within the function.
>
> something like
>
> def foo(param):
> 	print theNameOfTheVariablePassedToParam
>
> var1 = "hello"
> var2 = "world"
>
>  >>> foo(var1)
> var1
>
>  >>> foo(var2)
> var2
> 
> thanks in advance,
> 
> greets
> 
> Andreas Huesgen




More information about the Python-list mailing list