@staticmethod<EOL><INDENT>def gen_cartesian_product(*args):<DEDENT>
if not args:<EOL><INDENT>return []<EOL><DEDENT>elif len(args) == <NUM_LIT:1>:<EOL><INDENT>return args[<NUM_LIT:0>]<EOL><DEDENT>product_list = []<EOL>for product_item_tuple in itertools.product(*args):<EOL><INDENT>product_item_dict = {}<EOL>for item in product_item_tuple:<EOL><INDENT>product_item_dict.update(item)<EOL><DEDENT>product_list.append(product_item_dict)<EOL><DEDENT>return product_list<EOL>
generate cartesian product for lists,  笛卡尔积
        @param
            (list) args
                [{"a": 1}, {"a": 2}],
                [
                    {"x": 111, "y": 112},
                    {"x": 121, "y": 122}
                ]
        @return
            cartesian product in list
            [
                {'a': 1, 'x': 111, 'y': 112},
                {'a': 1, 'x': 121, 'y': 122},
                {'a': 2, 'x': 111, 'y': 112},
                {'a': 2, 'x': 121, 'y': 122}
            ]