Situation

Previously, I had only seen nested for loops in list comprehensions used to create two-dimensional lists.
However, I recently came across a nested for loop that passes the elements contained in a list to a function and stores the return values in a list. I thought list comprehensions were quite interesting.
exist_metrics = [modified_metric_name
for metric_name in ragas_metric_names
for modified_metric_name in text_modifier(metric_name)
if modified_metric_name in self.metrics]