>>> permutations('abc', 2) # a b c [('a', 'b'), ('a', 'c'), # a . x x ('b', 'a'), ('b', 'c'), # b x . x ('c', 'a'), ('c', 'b')] # c x x .