Aljosa Mohorovic wrote:

> can i do something like this:
> 
> s = "myFunction"
> a = s() # equals to: a = myFunction()

Functions are first-class objects in Python, so you can do:

def myFunction():
    # whatever

which creates a function object and binds the name myFunction to it. Then:

s = myFunction

just binds the name s to your function object, and therefore:

a = s()

is the same as:

a = myFunction()


-- 
Website: www DOT jarmania FULLSTOP com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to