Hi! now clientStuff.take_action() looks: ============== cut =========== def take_action(cmds, nulist, uplist, newlist, obslist, tsInfo, HeaderInfo, rpmDBInfo, obsdict): from yummain import usage _command = cmds.pop(0) if (conf.uid != 0) and \ (_command in ['install', 'update', 'clean', 'upgrade', 'erase']): errorlog(0, _('You need to be root to perform these commands')) sys.exit(1) if _command == 'install': action_install(cmds, nulist, tsInfo, HeaderInfo, rpmDBInfo) elif _command == 'provides': action_provides(cmds, nulist, HeaderInfo, rpmDBInfo) sys.exit(0) elif _command == 'update': action_update(cmds, nulist, uplist, newlist, obslist, tsInfo, HeaderInfo, rpmDBInfo) elif _command == 'upgrade': action_upgrade(cmds, nulist, uplist, obslist, tsInfo, HeaderInfo, rpmDBInfo, obsdict) elif _command in ['erase', 'remove']: action_erase(cmds, tsInfo, rpmDBInfo) elif _command == 'list': action_list(cmds, nulist, uplist, newlist, HeaderInfo, rpmDBInfo) sys.exit(0) elif _command == 'info': action_info(cmds, nulist, uplist, newlist, HeaderInfo, rpmDBInfo) sys.exit(0) elif _command == 'clean': action_clean(cmds, HeaderInfo, rpmDBInfo) sys.exit(0) else: usage() ============== cut =========== 1. I just "extract" each action into separate function, named action_* 2. List object can pop element, as result we pop command from cmds, once. each case modified like this: - elif cmds[0] == 'info': - cmds.remove(cmds[0]) + elif _command == 'info': I think, result very pretty ;) -- Bor.