Hi there, just a question about the example given in the lesson:

def get_food_from_fridge():
  if refrigerator.cooling == False:
    raise RefrigeratorException
    return food
def heat_food(food):
  if microwave.working == False:
    raise MicrowaveException
    return food
  food = get_food_from_fridge()
  food = heat_food(food)
except KitchenException:
  food = order_takeout()

Why should ‘food’ not be in between the brackets of get_food_from_fridge(), when it should be in heat_food(food)?


So your question is essentially: Why does get_food_from_fridge function not have a parameter?

When you you walk to your fridge, you are empty handed (no parameter), then you take food from the fridge, so you return with food

Reverse ask: Why should get_food_from_fridge have a parameter?

1 Like

Well, that’s exactly the question. But your answer explains it all; the food starts to be a part of the equation once it’s taken out of the fridge.

Makes sense, thanks!