<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]

> I'm parsing a simple file and given a line's keyword, would like to call
> the equivalently named function.

No, actually, you woudn't :-)  Doing so means that if your programs input 
specification ever changes, you have to rename all of the relevant 
functions.  Moreover, it leaves open the possibility that you might wind up 
calling a function you didn't intend.

The right way to solve this kind of problem is to list all the functions you 
wish to be able to call in this way, and then explicitly define a mapping 
from keywords to the appropriate functions.  Which is exactly what you're 
doing in

> 3. Place all my functions in dictionary and lookup the function to be 
> called


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to