Just return directly in the first exception handler:
def client(course, take):
meal = []
for _ in range(take):
try:
some_meal = next(course)
meal.append(some_meal)
except StopIteration:
return meal
if take % 2 == 0:
try:
some_meal = next(course)
meal.append(some_meal)
except StopIteration:
pass
return meal
although I'd still use the standard library more here and not have to catch those StopIteration
exceptions nearly as much:
from itertools import islice
def client(course, take):
meal = list(islice(course, take))
if take % 2 == 0:
some_meal = next(course, None)
if some_meal is not None:
meal.append(some_meal)
return meal