def __init__(self, insert_object): self.insert_object = insert_object def ask(self, *args): if args[0][:7] != 'please': return 'You must learn to say please first.' if not callable(getattr(insert_object, args[0][7:], None)): return 'Thanks for asking, but I know not how to ' + args[0][7:] if len(args) == 2: return eval('insert_object.' + args[0][7:] + str(args[1:])[:-2] + ')') return eval('insert_object.' + args[0][7:] + str(args[1:]))