Turning Strings into Functions
Freddy
freddycooper01 at yahoo.com
Fri Sep 26 11:51:37 EDT 2003
I guess I could do that. Right now I'm creating the use cases
dictionary in a totally separate module which knows nothing about my
main module's functions. But I will try either moving the code into my
current module, or including the testcases.py into my higher level
module.
Thanks for the suggestion.
Freddy
"Richard Brodie" <R.Brodie at rl.ac.uk> wrote in message news:<bl0usu$j5g at newton.cc.rl.ac.uk>...
> "Freddy" <freddycooper01 at yahoo.com> wrote in message
> news:46610d4e.0309251516.45a8eb01 at posting.google.com...
>
> > How do you turn a string into a callable function? I'm writing a
> > program which takes user input and then looks up the associated
> > function to run from a shelved dictionary.
>
> I see you have an answer already, so I'll give you a question.
> Is there any particular reason why you are storing the name
> of the function in the dictionary rather than the function itself?
>
> i.e. myDict["Case1"] = {"desc":"This is Case1", "func1": Handler1} etc
More information about the Python-list
mailing list