code: def xindexes(slots):
      
      # the first response...
      slot = [0] * len(slots)
      
      for i in range(reduce(operator.mul, slots)):
          yield slot
          
          carry = 1
          
          # iterate from the least to the most significant digit
          for j in range(len(slots), 0, -1):
              k = j - 1
              
              slot[k] += carry
              
              if slot[k] >= slots[k]:
                  carry = 1 + slot[k] - slots[k]
                  slot[k] = 0
              else:
                  carry = 0
docs: Generate list of possible indexes into a list of slots.
      
          Best way to think of this is as a number where each digit might have a different radix.
          E.g.: (10, 10, 10) would return 10 x 10 x 10 = 1000 responses from (0, 0, 0) to (9, 9, 9),
          (2, 2, 2, 2) would return 2 x 2 x 2 x 2 = 16 responses from (0, 0, 0, 0) to (1, 1, 1, 1).