calling variable function name ?

Blais, Gerard C. gblais at mitre.org
Tue May 6 08:17:43 EDT 2008


Sure!

 

Make a dictionary:

 

                fdict = {"A":fa, "B":fb, ... }

 

                Then consider

 

                x = "A"

 

                result = fdict(x)(param1, param2)

 

                should call fa without any if's...

 

                Gerry 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080506/db32e521/attachment-0001.html>


More information about the Python-list mailing list