# new new new
years = sorted(set((variant.intro_date, variant.end_date) for variant in self.model_variants))
# new new
years = set()
for variant in self.model_variants:
years.add((variant.intro_date, variant.end_date))
years = sorted(years)
#new
years = set()
for dates in [(variant.intro_date, variant.end_date) for variant in self.model_variants]:
years = years.union(dates)
years = sorted(years)
# old
years = sorted(reduce(set.union, [(variant.intro_date, variant.end_date) for variant in self.model_variants], set()))