def maximum(values): temp_max = -np.infty for v in values: if v > temp_max: temp_max = v yield temp_max