late bindings ???

Alfredo P. Ricafort alpot at mylinuxsite.com
Mon Dec 2 08:22:38 EST 2002


Hi,

I'm trying to create a flexible python program where the called
functions are stored in a list.  But before you can assign the function
name in a list, it must be in the namespace. However, in my case, the
function names are known later. So what I did was to store it as a
string instead and do something like this:

func=['do_file','do_exit']
apply(func[i],[args])

But this doesn't work!

Now, I am looking for something that can 'typecast' a variable into a
function. But it appears that there is none. It seems that in python
late bindings are not allowed.

Am I right?

Tks.

AL




More information about the Python-list mailing list