I once had a decorator for a script command line file.
The decorator was used as follows:
@command
def someFunc():
The decorator did something like this:
commands = {}
def command(func)
commands[func.__name__] = func
return func
And then I could do something like this:
commandName = raw_input()
commands[commandName]();
To read the command name from the console and call it - if earlier it was marked by the decorator (so dangerous calls would not be possible, as in the case with input).
( args, raw_input.)
, . - ", " . .
(BTW, there func.func_name), , func.__name__, , __, Python, AFAIK - )