class Test:

    def _pub_wrapper(self, verb, obj_type, id_list):
        print('  Called _pub_wrapper(', verb, ', ', obj_type, ', ', id_list, ')')
ids = [str(i) for i in id_list]
self._pub(ids, '{0}.{1}'.format(verb, obj_type.lower()))

def _pub(self, ids, something):
    print('    Called _pub( ', self, ', ', ids, ', ', something, ')')

def __getattr__(self, item):
    verb = item.split('_')[0]
obj_type = item.split('_')[-1]
if verb in ['new', 'changed', 'deleted'] and obj_type in ['resources',
    'items', 'banks']:

    def wrapper(*args, **kwargs):
        print('Within wrapper: verb=', verb, ', obj_type=', obj_type, ', args=', args, ', kwargs=', kwargs)
print('Within wrapper: ', verb, ', ', obj_type, ', ', args)
return self._pub_wrapper(verb, obj_type, args[0])
return wrapper
raise AttributeError
"""        
    def __getattr__(self, item):
        if item in ['new_resources', 'changed_resources', 'deleted_resources', 'changed_banks']:
            verb = item.split('_')[0]
            obj_type = item.split('_')[-1]
            print verb, " vs ", obj_type
            def wrapper(*args):
                print "Within wrapper: ", verb, ", ", obj_type, ", ",  args[0]
                return self._pub_wrapper(verb, obj_type, args[0])
            return wrapper
        raise AttributeError
    """

def fake_new_resources(self, id_list):
    self._pub_wrapper('new', 'resources', id_list)
t = Test()
print('Faking it... ')
t.fake_new_resources([])
print('New tries')
t.new_resources([])
t.changed_banks([])
t.deleted_items(['hi', 'bye'], 4, your=23, mine=42)
Написание общего getattr() и заполнение параметров метода на основе имени attr