On 4/12/2012 8:07, Tim Roberts wrote:
Kiuhnm<kiuhnm03.4t.yahoo.it>  wrote:

That won't do. A good example is when you pass a function to re.sub, for
instance.

This is an odd request.

All shall be revealed :)


I often pass functions to functions in order to simulate a C switch
statement, such as in a language translator:

   commands = {
     'add': doAdd,
     'subtract' : doSubtract,
     'multiply' : doMultiply,
     'divide' : doDivide
   }

   nextCommand = parseCommandLine( line )
   invokeCommand( commands[NextCommand] )

I like that very much. Thank you.

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

Reply via email to