Need to call functions/class_methods etc using string ref :How
Donn Ingle
donn.ingle at gmail.com
Mon Nov 26 11:12:23 EST 2007
> I see someone already showed you eval. Eval is evil. Don't use it.
> Especially if the functions are coming to you from a public URL!
Yes, I suggested to him (by email) this:
thisinstance = SomeObject.__class__.__dict__
<Then you have a list of strings that may be function names, so:>
for f in yourlist:
if f in thisinstance: eval(f)(params)
Which would vet the functions too.
\d
More information about the Python-list
mailing list