def all_pairs(singles):
 pairs = []
 singles = list(singles)
 while singles:
  suitor = singles.pop(0)
  pairs.extend(((suitor, single) for single in singles))
 return pairs

def all_pairs ( singles ) : pairs = [ ] singles = list ( singles ) while singles : suitor = singles . pop ( 0 ) pairs . extend ( ( ( suitor , single ) for single in singles ) ) return pairs
generate pairs list for all-against-all alignments .