[Tutor] Trying To Debug Code That Runs Arbitrary Function
alan.gauld at btinternet.com
Thu Dec 2 18:57:15 CET 2010
"Homme, James" <james.homme at highmark.com> wrote
> If you can get away with not telling me the answer, but pointing
> me to where to look for the answer, I'd be grateful.
OK, Don't use eval or exec they have secuity issues - especially if
strings from a file!
> idea is to read in strings from a file, look one up,
> and use it to execute a function.
Functions are objects sop can be stored as data.
Dictionariers can associate strings with arbitrary data - including
Is that enough of a hint? :-)
If not, try reading the OOP topic in my tutorial, under the section
"Collections of Objects" where I discuss the related scenario of
collections of objects with arbitrary (or user assigned) names/IDs.
Author of the Learn to Program web site
More information about the Tutor