def command ( name , mode ) : def decorator ( fn ) : commands [ name ] = fn . __name__ _Client . _addMethod ( fn . __name__ , name , mode ) return fn return decorator
python dynamically set a method name
Label a method as a command with name .
def command(name, mode):
    """ Label a method as a command with name. """
    def decorator(fn):
        commands[name] = fn.__name__
        _Client._addMethod(fn.__name__, name, mode)
        return fn
    return decorator