Re: Accessing the name of an actual parameter

2010-01-26 Thread Jean-Michel Pichavant
Duncan Booth wrote: Gary Herron wrote: It's naive to think this question even makes sense. There are many ways f can be called which don't involve a parameter: f(42) f(time()) f(a+123) f(sin(a)) f(f(1)) and so on. So long as the OP doesn't care if they get no names or several na

Re: Accessing the name of an actual parameter

2010-01-26 Thread Duncan Booth
Gary Herron wrote: > It's naive to think this question even makes sense. There are many ways > f can be called which don't involve a parameter: > > f(42) > f(time()) > f(a+123) > f(sin(a)) > f(f(1)) > > and so on. So long as the OP doesn't care if they get no names or several name that mig

Re: Accessing the name of an actual parameter

2010-01-26 Thread Gary Herron
Gary Herron wrote: Hellmut Weber wrote: Hi, consider the following piece of code, please - - def f(param): nameOfParam = ??? # here I want to access the name of the variable # which was given as parameter to the function print nameOfParam, param return if __name__ == __main

Re: Accessing the name of an actual parameter

2010-01-26 Thread Gary Herron
Hellmut Weber wrote: Hi, consider the following piece of code, please - - def f(param): nameOfParam = ??? # here I want to access the name of the variable # which was given as parameter to the function print nameOfParam, param return if __name__ == __main__: a = 1 f(a)

Re: Accessing the name of an actual parameter

2010-01-26 Thread Jean-Michel Pichavant
Hellmut Weber wrote: Hi, consider the following piece of code, please - - def f(param): nameOfParam = ??? # here I want to access the name of the variable # which was given as parameter to the function print nameOfParam, param return if __name__ == __main__: a = 1 f(a)

Re: Accessing the name of an actual parameter

2010-01-26 Thread Alf P. Steinbach
* Hellmut Weber: consider the following piece of code, please - - def f(param): nameOfParam = ??? # here I want to access the name of the variable # which was given as parameter to the function print nameOfParam, param return if __name__ == __main__: a = 1 f(a) b = '

Re: Accessing the name of an actual parameter

2010-01-26 Thread Chris Rebert
On Tue, Jan 26, 2010 at 3:48 AM, Hellmut Weber wrote: > Hi, > > consider the following piece of code, please > > - - > > def f(param): >  nameOfParam = ??? >  # here I want to access the name of the variable >  # which was given as parameter to the function >  print nameOfParam, param >  r

Accessing the name of an actual parameter

2010-01-26 Thread Hellmut Weber
Hi, consider the following piece of code, please - - def f(param): nameOfParam = ??? # here I want to access the name of the variable # which was given as parameter to the function print nameOfParam, param return if __name__ == __main__: a = 1 f(a) b = 'abcd' f(a)