def sort_cards_by_rank_int(card_ints): def cmp_card(x, y): return Card.get_rank_int(x) - Card.get_rank_int(y) if is_py3: return sorted(card_ints, key=cmp_to_key(cmp_card), reverse=True) return sorted(card_ints, cmp=cmp_card, reverse=True)
def sort_cards_by_int(card_list): def cmp_card(x, y): return x - y if is_py3: return sorted(card_list, key=cmp_to_key(cmp_card), reverse=True) return sorted(card_list, cmp=cmp_card, reverse=True)
def sort_cards(cards): if is_py3: return sorted(cards, key=cmp_to_key(lambda x, y: CARD_IDX[x] - CARD_IDX[y])) return sorted(cards, cmp=lambda x, y: CARD_IDX[x] - CARD_IDX[y])