Getting the name of a variable which was used as a function parameter.

Fredrik Lundh fredrik at
Mon Jul 21 23:38:06 CEST 2008

Ravi Kotecha wrote:

> Of course I wouldn't, it is a total hack, mostly useless but fun.  I
> tried to do it after someone in #python efnet said it was impossible!

your function only finds *some* name (if it finds a name at all), not 
*the* name, so you haven't really proven that someone wrong yet.

you can get a lot closer by using more radical approaches, but I don't 
think it's possible to do this in a fully robust way, at least not from 
the Python level.


More information about the Python-list mailing list