def combinations(l):
 result = []
 for x in range((len(l) - 1)):
  ls = l[(x + 1):]
  for y in ls:
   result.append((l[x], y))
 return result

def combinations ( l ) : result = [ ] for x in range ( ( len ( l ) - 1 ) ) : ls = l [ ( x + 1 ) : ] for y in ls : result . append ( ( l [ x ] , y ) ) return result
pure-python implementation of itertools .