python - How get names of passed parameters inside a function -


is there simple way names of parameters passed python function, inside function?

i'm building interactive image processing tool works @ python command line.

i'd able this:

beta = alpha * 2;  # double pixel values in numpy array   save(beta)         # save image beta in filename "beta.jpg"   

the alternative make user explicitly type filename, typing i'd avoid:

beta = alpha * 2;  # double pixel values in numpy array   save(beta, "beta") # save image beta in filename "beta.jpg"   

sadly, cannot.

how original variable name of variable passed function

however, this

def save(**kwargs):     item in kwargs:         print item #this name of variable passed in         print kwargs[item] #this value of variable passed in. save(test='toast') 

although, better practice such

def save(name,value):     print name     print value  save("test","toast") 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -