class CommandSource(object):

    def listCommands(self, *args, **kwargs):
        commands = []
for command in dir(self.__class__):
    func = getattr(self, command, None)
if func == None or getattr(func, 'command', False) == False:
    continue
for validator in func.validators:
    if not validator(self, *args, **kwargs):
        break
else:
    commands.append(command)
return commands
Как обрабатывать аргумент «я» с помощью декораторов Python