def ByNestedComprehnsionAlogrithm(*sets):
   """Returns a list of all element combinations from the given sets.
      A combination is represented as a tuple, with the first tuple
      element coming from the first set, the second tuple element
      coming from the second set and so on.
      A set may be any iterable to which the not operator is applicable.
   """
   g = []
   for set in sets:
      if not set: return []
      if g:
         g = [ i + (j,) for i in g for j in set ]
      else:
         g = [(j,) for j in set]
   return g
Returns a list of all element combinations from the given sets.
      A combination is represented as a tuple, with the first tuple
      element coming from the first set, the second tuple element
      coming from the second set and so on.
      A set may be any iterable to which the not operator is applicable.
   
recipes/Python/410685_Generic_vs_Specific_Algorithms__Obtaining_All/recipe-410685.py