Getting the argument names passed to a function ?

Fredrik Lundh effbot at
Tue Apr 4 17:08:55 EDT 2000

Andreas Jung <ajung at> wrote:
> def myfunc(arg1,arg2):
> ...
> a=1;b=2
> myfunc(a,b)
> Is it possible to get the name of variables that  were
> used as arguments to call myfunc(). myfunc() should be
> able to determine the names 'a' and 'b'. Don't ask
> me why I need this - it's for a worse Python hack :-)

short answer: no

longer answer: maybe, using the incredibly clever and
totally evil bytecodehacks stuff:


<!-- (the eff-bot guide to) the standard python library:

More information about the Python-list mailing list