Method check_list_comprehension have list comprehension which is returning the correct result, but I have called another method inside list comprehension code, I would like to have just one method which will return the same result.
def check_list_comprehension():
    links = [{'link': 'test.com', 'params': {}}]
    previous_url_results = [{'for_next_params': {'seckey': 'gjgJG'}}, {'for_next_params': {'seckey': 'gjfggJG'}},
                            {'for_next_params': {'seckey': 'gjgJfgggG'}}]
    links = [_operations(link, previous_url['for_next_params'])
             for link, previous_url in itertools.product(links, previous_url_results)
             if 'for_next_params' in previous_url
             ]
    print(links)
def _operations(link, y):
    link['params'] = {**link['params'], **y}
    return link
check_list_comprehension()
The output of this code:
[{'link': 'test.com', 'params': {'seckey': 'gjgJfgggG'}}, {'link': 'test.com', 'params': {'seckey': 'gjgJfgggG'}}, {'link': 'test.com', 'params': {'seckey': 'gjgJfgggG'}}]
Please suggest a better pythonic way to do it.
 
    