>>> def get_squares(): ... yield from (num ** 2 for num in range(10)) ... >>> list(get_squares()) [0, 1, 4, 9, 16, 25, 36, 49, 64, 81]